Measure dimensions of each part in an assembly using iLogic

Measure dimensions of each part in an assembly using iLogic

devonsZN5MQ
Explorer Explorer
608 Views
1 Reply
Message 1 of 2

Measure dimensions of each part in an assembly using iLogic

devonsZN5MQ
Explorer
Explorer

Hi All

 

I'm relatively new to iLogic so please excuse if this question is trivial.

 

I am trying to write an ilogic code that:

- looks at an assembly,

- fetches all the parts in the assembly,

- measures their extent dimensions, and then

- groups them according to some condition (for example if max_extent/min_extent > 10 then MessageBox.Show("This is a plate"))

My current code only measures the extents of the full assembly, instead of each individual part, which is of no use to me.

Any help would be much appreciated, thanks!

 

' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument

' Get the assembly component definition.
Dim oAsmDef As AssemblyComponentDefinition
oAsmDef = oAsmDoc.ComponentDefinition

' Get all of the leaf occurrences of the assembly.
Dim oLeafOccs As ComponentOccurrencesEnumerator
oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences

' Iterate through the occurrences and print the name.
Dim oOcc As ComponentOccurrence
For Each oOcc In oLeafOccs
	meas = Measure.ExtentsLength 'here is where I am having my problem
    MessageBox.Show(oOcc.Name & meas)
Next

 

 

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

theo.bot
Collaborator
Collaborator
Accepted solution
0 Likes