Boolean to control solid visibility

Boolean to control solid visibility

Anonymous
Not applicable
435 Views
2 Replies
Message 1 of 3

Boolean to control solid visibility

Anonymous
Not applicable

I've looked through the forums but can't seem to find the right code.

For example, I have a boolean parameter called Solid and a solid body called Solid_Body

I would like to be able to do something like feature/component suppression if the boolean value changes, for example:

If Solid = True then

Solid_Body= 1

else

Solid_Body= 0

end if

What would be the code to do something like this?

 

Thank you

 

0 Likes
Accepted solutions (1)
436 Views
2 Replies
Replies (2)
Message 2 of 3

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, The following is an ilogic code. For it to work you must have a solid called "Solid_Body", you must have a Boolean parameter called "solid".
If solid is true the solid will be visible, if it is false it will be hidden.

 

Dim doc As PartDocument= ThisDoc.Document
Dim oCD As ComponentDefinition = doc.ComponentDefinition

For i As Integer = 1 To oCD.SurfaceBodies.Count
	Dim oSolid As SurfaceBody = oCD.SurfaceBodies.Item(i) 
	If oSolid.Name = "Solid_Body" Then
		If Solid = True Then
			oSolid.Visible = True
		Else
			oSolid.Visible = False
		End If
	End If
Next i

 I hope the code is useful for you. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 3

bradeneuropeArthur
Mentor
Mentor

Comments removed ...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes