Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help: iLogic to pull value from extrusion dimension without rename

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
cereakes
1237 Views, 4 Replies

Help: iLogic to pull value from extrusion dimension without rename

I am trying to find a way to have iLogic code that looks at a part with only one extrusion, such as bar stock or angle stock and automatically export the length to iProperties. As per the request of the other engineers however, this code cannot be based on a common renamed parameter. Also, since no one draws things the same exact way, it can't be based off of a common dimension parameter either. At least not in terms of d0,d1..etc. 

 

Is there such thing as a code similar to variable=standard.extrusionextentslength that I can imbed within an if then that would pull this information from the model?

4 REPLIES 4
Message 2 of 5
jtylerbc
in reply to: cereakes

Are these stock items that you are building yourselves, or using the standard items out of Content Center?

 

If not using Content Center, would it be possible to use CC for what you need?  If your engineers are constantly manually remodeling bar stock and angle shapes, there may be time to be saved by changing that process.  It would also make it easier to achieve your original request, since the model methods would be consistent.

Message 3 of 5

Hi cereakes,

Below is a real quick adaptation from this thread:

http://forums.autodesk.com/t5/Autodesk-Inventor/Part-Measure-gets-planes/m-p/3843039#M466854

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

oDoc = ThisDoc.Document

Dim MyArrayList As New ArrayList

'toggle work plane visibility off
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
    If oWorkPlane.Visible = True Then
    oWorkPlane.Visible = False
    'add workplane to the array list
    MyArrayList.add(oWorkPlane.name)   
    End If
Next

'toggle work axes visibility off
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
    If oWorkAxis.Visible = True Then
    oWorkAxis.Visible = False
    'add workplane to the array list
    MyArrayList.add(oWorkAxis.name)   
    End If
Next

'toggle work points visibility off
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
    If oWorkPoint.Visible = True Then
    oWorkPoint.Visible = False
    'add workplane to the array list
    MyArrayList.add(oWorkPoint.name)   
    End If
Next

'get measurements
My_x = Measure.ExtentsLength
My_y = Measure.ExtentsWidth
My_z = Measure.ExtentsHeight

'Make longest value the Length, rounded to 2 places
MaxLength = Round(MaxOfMany(My_x, My_y, My_z), 2)

Dim propertyName1 As String = "Length"

 'define custom prpoerty collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

 Try
'set property value
oProp = oCustomPropertySet.Item(propertyName1)
Catch
' Assume error means not found so create it
oCustomPropertySet.Add("", propertyName1)
End Try

 'set custom property value
iProperties.Value("Custom", "Length") = MaxLength

'show max value
MessageBox.Show("The length is: " & MaxLength, "ilogic")

'toggle work plane visibility back on
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
    If MyArrayList.contains(oWorkPlane.Name) = True Then
    oWorkPlane.Visible = True
    End If
Next

'toggle work axes visibility back on
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
    If MyArrayList.contains(oWorkAxis.Name) = True Then
    oWorkAxis.Visible = True
    End If
Next

'toggle work points visibility back on
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
    If MyArrayList.contains(oWorkPoint.Name) = True Then
    oWorkPoint.Visible = True
    End If
Next

 

Message 4 of 5

I almost posted a very similar rule to Curtis's, because I use something like it every day that I could have easily modified for this situation.  I decided against it because it does have a potential flaw depending on exactly what you're building.  If this situation doesn't apply to you, his rule should be a good solution.

 

If the length of the extrusion is ever smaller than the width of the profile, you will get the wrong result from the rule.  For example, let's say you're using 5x5 angle, and cutting a 2" long section to make a bracket.  The rule will measure in X, Y, and Z directions, then find the longest and set it to the length.  In this case, the largest dimension is not the length, but one of the 5" dimensions for the angle legs.  Thus, it will say the angle is 5" long, when it should say 2".

Message 5 of 5
mrattray
in reply to: cereakes

I agree with John. Hand modeling every piece of angle iron is silly in the first place. The closest I ever get to actually modeling a piece of stock is by placing an iFeature...
However, there is the ModelParameter.Parent property. Perhaps we could loop through a document's ModelParameters collection searching for a parameter whose parent feature's type is an extrusion? The help seems to be lacking in regards to the Parent property and I've never used it, so I'm not sure what it would actually return.
Mike (not Matt) Rattray

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report