iLogic drawing - Component.IsActive

iLogic drawing - Component.IsActive

m_baczewski
Advocate Advocate
240 Views
1 Reply
Message 1 of 2

iLogic drawing - Component.IsActive

m_baczewski
Advocate
Advocate

Hello,

 

Is it possible to use phrase Component.IsActive in drawing? I`m trying to add balloons while component is active but cant to do it because i getting error "Component: This function can only be used within the scope of a assembly."

Dont want to use try catch its cost to much time and dont want go through API.

Do you know clever solution?

0 Likes
Accepted solutions (1)
241 Views
1 Reply
Reply (1)
Message 2 of 2

MjDeck
Autodesk
Autodesk
Accepted solution

You can do it in Inventor 2021 and later.
Here's sample code:

Dim modelDoc = ThisDrawing.ModelDocument
Dim modelObjects = StandardObjectFactory.Create(modelDoc)

If modelObjects.Component.IsActive("Part435a:1") Then
	Logger.Info("Part435a:1 is unsuppressed")
Else
	Logger.Info("Part435a:1 is suppressed")
End If

This will work if the first view in the drawing is a view of the assembly.
(If it isn't, you can also get the ModelDocument for particular views.)

The modelObjects object gives you the standard iLogic objects for the assembly document.
In this context, instead of using Component.IsActive you would use modelObjects.Component.IsActive.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes