Named surface with Ilogic exported as DXF Inventor 2022

Named surface with Ilogic exported as DXF Inventor 2022

norbert.wiegmann
Contributor Contributor
392 Views
2 Replies
Message 1 of 3

Named surface with Ilogic exported as DXF Inventor 2022

norbert.wiegmann
Contributor
Contributor

Hello together,

Since the IV version 2019 it is possible to assign a name to a surface. Now I want to access the name of the surface via iLogic and export it as DXF. In the sippets there is also a syntax for it

Dim namedEntities = ThisDoc.NamedEntities

But somehow I can't get it in the right order.

With the following syntax I get it, if you select the corresponding area with the mouse.

ThisApplication.CommandManager.Pick(kPartFacePlanarFilter,

However, I want to automatically process an Excel file, so it would be annoying to have to click on the face again and again.

I hope you can help me.

 

0 Likes
Accepted solutions (2)
393 Views
2 Replies
Replies (2)
Message 2 of 3

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @norbert.wiegmann . This is the iLogic code that exports the "Face0" plane (line 8) to .dxf format. The code must be run in the part document. I don't quite understand how you need to use Excel, please describe all the logic you need to export DXF.

 

Dim oCM As CommandManager = ThisApplication.CommandManager
Dim oThisDOC As ICadDoc = ThisDoc
Dim oDoc As Document = oThisDOC.Document
Dim sName As String = System.IO.Path.ChangeExtension(oDoc.FullDocumentName, ".dxf")
If Not TypeOf oDoc Is PartDocument Then Exit Sub
Dim oPDoc As PartDocument = oDoc
Dim oSS As SelectSet = oPDoc.SelectSet
Dim oFace As Face = oThisDOC.NamedEntities.TryGetEntity("Face0")
oCM.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, sName)
oSS.Select(oFace)
oCM.ControlDefinitions("GeomToDXFCommand").Execute()
oSS.Clear()
System.Diagnostics.Process.Start("explorer.exe", "/select,""" & sName & """")

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 3 of 3

norbert.wiegmann
Contributor
Contributor
Accepted solution

Hello Andrii
The line 8 was exactly what I needed.
Thank you very much for that.
Here is my Ilogic code

 

			oDoc = ThisApplication.ActiveDocument
			oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")
			 oFace = ThisDoc.NamedEntities.TryGetEntity("DXF_Flaeche")
			
			sFullFilename = ThisDoc.PathAndFileName(False)
	oSelectSet = oDoc.SelectSet
	Call ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, sFullFilename  & ".dxf")
	Call oDoc.SelectSet.Clear
	Call oDoc.SelectSet.Select(oFace)
	Call oControlDef.Execute2(True)
	Call oDoc.SelectSet.Clear