Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how it be in Visual Basic

Status
Not open for further replies.

ialscorp

Automotive
Aug 31, 2007
20
0
0
RU
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
 
Replies continue below

Recommended for you

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
 
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'.

 
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
 
Status
Not open for further replies.
Back
Top