Export flat pattern with iProperty as filename

Export flat pattern with iProperty as filename

Anonymous
Not applicable
679 Views
9 Replies
Message 1 of 10

Export flat pattern with iProperty as filename

Anonymous
Not applicable

Hi all,

 

Is there a way to export a dxf with a custom iProperty as filename? It would be great if i can click on a face of a part and select the face to export it as a dxf.  Something like "Export face as" but then with the right name.

 

Many thanks

0 Likes
Accepted solutions (1)
680 Views
9 Replies
Replies (9)
Message 2 of 10

mcgyvr
Consultant
Consultant

Are you familiar with ilogic?

There is no "out of the box" solution but some ilogic code can handle the request for you..

 

If you need help please indicate the specific name of the custom iproperty and we can help modify the code posted here..

https://forums.autodesk.com/t5/inventor-customization/help-code-for-quot-export-face-as-quot-have-tr...

Specifically the code in post 9 in that thread



-------------------------------------------------------------------------------------------
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
Message 3 of 10

Anonymous
Not applicable

Thanks for the reply, I'm not that good with iLogic but I know how to make and use rules.

The Custom iProperty is POS.

 

Regards, Wim

0 Likes
Message 4 of 10

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

 

		
Dim doc As PartDocument= ThisDoc.Document
Dim oPath As String = ThisDoc.Path & "\"
Dim My_Prop As String = doc.PropertySets.Item("Inventor User Defined Properties").Item("POS").Value
		
Dim oFilename As String =  oPath & My_Prop  &  ".dxf"

Dim oCommand As CommandManager
oCommand = ThisApplication.CommandManager

oCommand.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,oFilename) 
oCommand.ControlDefinitions.Item("GeomToDXFCommand").Execute2(True)

Hi, click on a flat face and then try to execute this ilogic code. I think it could be useful. save a dxf in the path of your active file. It will take the name of the custom property "POS"
I hope this helps. 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 5 of 10

Anonymous
Not applicable

This will do it.  Thank you very much!!!

0 Likes
Message 6 of 10

Anonymous
Not applicable

Hi Sergio,

I think there's something wrong with the rule.  When I open multiple parts to save them as a DXF, the rule pick properties from another part.  So the 'POS' fields doesn't match with geometry.  Is this solvable?

 

Many thanks,

 

Wim Webers

0 Likes
Message 7 of 10

Sergio.D.Suárez
Mentor
Mentor

I think maybe you're trying to run the rule from an assembly that contains the parts. The rule refers to the active document, and if it is an assembly it will return data from an assembly. If this is so, I'll see if I can modify it so that the actions from an assembly. 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

0 Likes
Message 8 of 10

Sergio.D.Suárez
Mentor
Mentor

If you are working from a master assembly try this rule, I have not tried it, but I think it should work.
Keep in mind that it will return error if there is no "POS" property in the part.

Dim oFace As FaceProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select Face")
	If oFace Is Nothing Then Exit Sub
		
Dim oOcc As ComponentOccurrence = oFace.ContainingOccurrence

oOcc.Edit
		
Dim doc As PartDocument = oFace.NativeObject.Parent.Parent.document

Dim oPath As String = Left(doc.FullFileName, (InStrRev(doc.FullFileName, "\", -1, vbTextCompare)))

Dim My_Prop As String = doc.PropertySets.Item("Inventor User Defined Properties").Item("POS").Value
		
Dim oFilename As String = oPath & My_Prop & ".dxf"

Dim oCommand As CommandManager
oCommand = ThisApplication.CommandManager

oCommand.DoSelect(oFace)'Select face
oCommand.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,oFilename) 
oCommand.ControlDefinitions.Item("GeomToDXFCommand").Execute2(True)

oOcc.ExitEdit(63747)

 

I hope I help you with your problem. 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 9 of 10

Anonymous
Not applicable

I'm exporting from a part and not from an assembly, but I opened them from the BOM in an assembly.  Now I opened them again, closed the assembly and start to export and it works now.  I'm not sure if there was the problem is but is working now.

Thanks for your time.

 

Regards, Wim

0 Likes
Message 10 of 10

jimmydieck
Participant
Participant

Does the .dxf file default to a certain file type and version (i.e. AutoCAD 2013 DXF vs. 2018 )? If not, is there a way this can be controlled using code or properties in Inventor?

 

Thank you,

Jimmy

0 Likes