Extents from .ipt part without rule

Extents from .ipt part without rule

M_Tuma
Explorer Explorer
423 Views
3 Replies
Message 1 of 4

Extents from .ipt part without rule

M_Tuma
Explorer
Explorer

Hi,
Is possible get flat extent dimensions from part without rule inside .ipt?
I am looking for rule inside .idw, which can get these informations. Code below works fine with parameters, but flat extents are not in parameters.
I didnt use default method (<FLAT PATTERN LENGTH>), because I need this dimensions rounded up with increment.
Thanks for advice
 

VyhoziModel = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) ' Get first input model name

Rozvin_delka = Parameter(VyhoziModel+".SheetMetal.FlatExtentsLength") ' HERE I NEED GET EXTENTS LENGTH
Rozvin_sirka = Parameter(VyhoziModel+".SheetMetal.FlatExtentsWidth") ' HERE I NEED GET EXTENTS WIDTH

inc = 0.1 ' rounding increment ( .125, .25, .5, etc)
iProperties.Value("Custom", "ROZVIN")=
Ceil(Round(Rozvin_delka,4) / inc) * inc & " x " & Ceil(Round(Rozvin_sirka,4) / inc) * inc ' IDW iProperties

 

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

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi Martin Tůma,

 

Firstly, it looks like your product license number is set as your forum "handle", it might be a good idea to edit that, so that your number isn't exposed to the world.

 

But for your question, I think we must use the API for this, as the ilogic calls do not provide a way to access the sheet metal extents from the drawing. See the example below.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

'get model document
Dim oDoc as PartDocument 
oDoc = ThisDrawing.ModelDocument

Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition

'open a view of the model document
Dim openedView As Inventor.View = Nothing
If oDoc IsNot ThisApplication.ActiveDocument Then
	openedView = oDoc.Views.Add()
	oDoc.Activate()
End If

'unfold to make sure the flat pattern exists
oCompDef.Unfold 
'get length
Rozvin_delka = oCompDef.FlatPattern.Length
'get width
Rozvin_sirka = oCompDef.FlatPattern.Width

'close model
If openedView IsNot Nothing Then
	openedView.Close()
End If 

'round values
inc = 0.1 ' rounding increment ( .125, .25, .5, etc)
Rozvin_delka = Ceil(Round(Rozvin_delka,4) / inc) * inc 
Rozvin_sirka = Ceil(Round(Rozvin_sirka,4) / inc) * inc 

'set IDW iProperty
iProperties.Value("Custom", "ROZVIN") = 
Rozvin_delka & " x " & Rozvin_sirka

'display result
MessageBox.Show(iProperties.Value("Custom", "ROZVIN") , "iLogic")

EESignature

0 Likes
Message 3 of 4

mcgyvr
Consultant
Consultant

and you can always just push the extents to custom iprops in the part file then access them in the drawing..

yes the rule to do that is in the ipt.. but so what..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 4 of 4

M_Tuma
Explorer
Explorer

Thanks, it works well.