Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

need some help reprogramming my codes

1 REPLY 1
Reply
Message 1 of 2
berry.lejeune
139 Views, 1 Reply

need some help reprogramming my codes

Hello all,

So I've got two iLogic's which I want to combine. But I don't seem to get what I want. One of the codes is from an ipt. This code is to make a dxf in a predefined folder and this is working good. The other code is from an idw and this one makes a pdf in a predined folder as well as a pdf in the folder where the idw is. 

Now I was trying to change the code from the ipt so that a dxf is being made in the folder where the ipt is. I've tried to combine both codes in several ways but I just don't get it good.

 

This is the code in my idw: a pdf gets made on a fixed location (g:\pdf\2022\ and another pdf is made in the folder where the idw is (ex: I:\Workspace\Ontwerpen\2022\20221169) and in this folder a new subfolder \pdf is made and there also a pdf is being made

'define the folder where you want to save the files
oFolder = "g:\pdf\2022\"

'grab the filename
oFileName = ThisDoc.FileName(False) 'without extension

'create the folder if it doesn't exist
If Not System.IO.Directory.Exists(oFolder) Then 
    System.IO.Directory.CreateDirectory(oFolder)
End If


'save as a pdf
ThisDoc.Document.SaveAs(oFolder & oFileName & -1 & ".pdf", True)

oPath = ThisDoc.Path
'get STEP target folder path
oFolder = oPath & "\" & oAsmName & " PDF"
'Check for the step folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
ThisDoc.Document.SaveAs(oFolder & "\" & oFileName &(".pdf") , True)

 

This is my rule for the dxf. I have to select a face in the ipt and then run the rule and a dxf is being made in a predefined folder.

 

'Export face to pre-defined folder

If ThisApplication.ActiveDocument.SelectSet.Count = 0 Then
	MsgBox("Face not selected. Aborting Rule!")
	Exit Sub
End If
oFolder = "Z:\"
oFileName = oFolder & ThisDoc.FileName & ".dxf"

Dim oCmdMgr As CommandManager
oCmdMgr = ThisApplication.CommandManager

Call oCmdMgr.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oFileName)
Call oCmdMgr.ControlDefinitions.Item("GeomToDXFCommand").Execute

 Now I would like to change my rule for the dxf so that in the folder where my parts are, a new folder is being made "\dxf\" and the dxf is stored overthere

 

The rules I use are the ones I found overhere and I managed to change them a bit to suit my needs but I seem not to be able to change this one now

 

Thanks

1 REPLY 1
Message 2 of 2

Hello @berry.lejeune 

You just need to change oFolder string to below. It will work for you.

 

 

 

oFolder = ThisDoc.Path & "\dxf"
If System.IO.Directory.Exists(oFolder) = False Then
    System.IO.Directory.CreateDirectory(oFolder)
End If
oFileName = oFolder & "\" & ThisDoc.FileName(False) & ".dxf"

 

 

 

 

Regards,
Jatin Devaiya

If a response answers your question, please use ACCEPT SOLUTION to assist other users later.


Also be generous with Likes! Thank you and enjoy!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report