Ilogic: Sketch/ Sketch Dimension visibility for part inside a assemblie

Ilogic: Sketch/ Sketch Dimension visibility for part inside a assemblie

ward_hanotGZU45
Enthusiast Enthusiast
337 Views
3 Replies
Message 1 of 4

Ilogic: Sketch/ Sketch Dimension visibility for part inside a assemblie

ward_hanotGZU45
Enthusiast
Enthusiast

Hello everybody,

 

Is there a way to use an ilogic code to turn a sketch or sketch dimension on that is used for a feature in a part?

I have a assembly with 3 parts. On one part i have several features (extrude cuts). 

I use a form to unsuppres these feature and to change the dimension in the assemblie on the part level. 

I would like to see the sketch or sketch dimensions for these features when they are unsuppresed.

Par example: when DeurZicht1 is true the sketch Z1DO should become visible. Z1DOML is the dimension in the sketch Z1DO witch positions the Dooropening.

Since there a several features, turning them all on or off at once is not prefferd.

 

ward_hanotGZU45_1-1715598080866.png

 

I suppose this is possible but I haven't found a code yet to accomplishe this.

0 Likes
338 Views
3 Replies
Replies (3)
Message 2 of 4

BM_Ashraf
Advocate
Advocate

Hi @ward_hanotGZU45 


I Think using Inventor API is a better way to get what you are looking for.
Please check the names!
At the end you will get the sketch and the parameter. You can turn the visibilty of the sketch on/off

Dim oASMDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oASMCDEF As AssemblyComponentDefinition = oASMDoc.ComponentDefinition 
'Dim oCC As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Part Doc")
Dim oCC As ComponentOccurrence
Dim oRefDoc As PartDocument
For Each oCC In oASMCDEF.Occurrences
	If oCC.Name = "Cabine-Start:1 (325)" Then 'Please re-check if the name is correct!!!
		oRefDoc = oCC.ReferencedDocumentDescriptor.ReferencedDocument
		Exit For 
	End If 
Next 	

If oRefDoc Is Nothing Then
	MsgBox("Couldn't find the file: " & "Cabine-Start:1 (325)" )
	Exit Sub 
End If 	
Dim oPCDEF As PartComponentDefinition = oRefDoc.ComponentDefinition
Dim oZ1DOE As PlanarSketch 

Try
	oZ1DOE  = oPCDEF.Sketches.Item("Z1DO") 'Please re-check if the name is correct!!!
	oZ1DOE .Visible = True 
Catch 
	MsgBox("Couldn't find the Sketch: " & "Z1DO")
	Exit Sub 
End Try	

Dim oParameter As Parameter 

Try
	oParameter = oPCDEF.Parameters.Item("Z1DOML") 'Please re-check if the name is correct!!!
Catch 
	MsgBox("Couldn't find the Parameter: " & "Z1DOML")
	Exit Sub 
End Try	
	
	

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.

Blue Mech

Add-ins for Inventor!

0 Likes
Message 3 of 4

ward_hanotGZU45
Enthusiast
Enthusiast

Sorry for the late reply, but this doesn't seem to work, I changed the names for Cabine-start:1 (325) to Cabine-start:1 because it coulnd't find it. But then it still doens't work.

Could it be a problem that the sketch is at a part level and not at an assembly level?

 

0 Likes
Message 4 of 4

BM_Ashraf
Advocate
Advocate

Hi,

To save the time, please upload test files.

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.

Blue Mech

Add-ins for Inventor!

0 Likes