×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how it be in Visual Basic

how it be in Visual Basic

how it be in Visual Basic

(OP)
could anyone to help
I know in GRIP but in VB :(
how to work with drawing objects
i need just to check colors of object
if color number is wrong, prompt the user...

where is mistake

error:"Number of indices is less than the number of dimensions of the indexed array" in line with "askdisplayedobjects"

code:

Sub check_colors
    Dim theSession As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    
    Dim drawingSheets() As DrawingSheet
    Dim mySheet as DrawingSheet
    drawingSheets = workPart.DrawingSheets.toArray
    Dim dfviews() As DraftingView
    Dim dfview As DraftingView
    
        Dim num_objects As Integer
        Dim objects() As Tag
    For Each mySheet  In drawingSheets
    dfviews = mySheet.GetDraftingViews()
        For Each dfview  In dfviews
           
                        
            ufs.Draw.AskDisplayedObjects( dfview.tag,num_objects , objects())
            
        Next
    Next
    End sub

RE: how it be in Visual Basic

I think the problem is that you are specifying your array wrong.
I think it needs to be :
ufs.Draw.AskDisplayedObjects( dfview.tag,num_objects , objects)

or possibly you need to have an integer counting through the dfviews and specify a sinlge item in the array

dim my_int as integer = 0
For Each mySheet  In drawingSheets

    dfviews = mySheet.GetDraftingViews()
        For Each dfview  In dfviews
           
                        
            ufs.Draw.AskDisplayedObjects(dfview.tag,num_objects , objects(my_int))
            my_int = my_int + 1
        Next
    Next

Mark Benson
Aerodynamic Model Designer

RE: how it be in Visual Basic

(OP)
already tried these cases
in first case

[ufs.Draw.AskDisplayedObjects( dfview.tag,num_objects , objects)]

Runtime error:
NXOpen.NXException: Input tag is not a section view.
   at NXOpen.UF.UFDraw.AskDisplayedObjects(Tag view, Int32& num_objects, Tag[]& objects)

in second

[ufs.Draw.AskDisplayedObjects(dfview.tag,num_objects , objects(my_int))]

Syntax errors:
 Value of type 'NXOpen.Tag' cannot be converted to '1-dimensional array of NXOpen.Tag'.

RE: how it be in Visual Basic

The first one is correct then.
You have another problem.

As the error tells you the tag is not correct for what you are trying to do.
The tag you are obtaining is the tag of the view not the objects in it.
You need to have a look at the mebers of drawingview to see if there is any way of listing the objects in the view and obtaining their tags.

Mark Benson
Aerodynamic Model Designer

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources