Run AutoCad Commands from iLogic

Run AutoCad Commands from iLogic

dalton98
Collaborator Collaborator
1,085 Views
7 Replies
Message 1 of 8

Run AutoCad Commands from iLogic

dalton98
Collaborator
Collaborator

Hello. I'm not sure if this is possible, but I thought I'd ask...

I found an iLogic rule online that creates a dxf file from the flat pattern view.

https://clintbrown.co.uk/2020/09/05/ilogic-export-all-flat-patterns-to-one-dxf/

 

From there I have to open the newly created dxf file and delete/rename the layers assigned in order for our burn tables to read it. I wrote a simple script to fix the layers(merges layer IV_INTERIOR_PROFILE to layer 0)

-----------------------------------------------------fileType.scr

-LAYMRG
N
IV_INTERIOR_PROFILES

 

N
0
Y

-----------------------------------------------------

Would it be possible to open the AutoCad file, run a script, and close it all in iLogic?

 

Much Appreciated,

Dalton Parrish

0 Likes
Accepted solutions (1)
1,086 Views
7 Replies
Replies (7)
Message 2 of 8

Michael.Navara
Advisor
Advisor
Accepted solution

You can start AutoCAD program from iLogic

In arguments you can specify drawingFileName and you can use /b script file. Here is more info

 

Sample call from iLogic can looks like this

Dim acadExe = "C:\Program Files\Autodesk\AutoCAD 2020\acad.exe"
Dim dwgFile = "C:\Path\To\Drawing.dwg"
Dim scriptFile = "C:\Path\To\TestSrcipt.scr"
Dim args = dwgFile & " /b " & scriptFile
Process.Start(acadExe, args)
0 Likes
Message 3 of 8

dalton98
Collaborator
Collaborator

@Michael.Navara 

I couldn't get that solution to work

Process.Start(dwgFile) opens the desired file, but I still dont know how to automate running the scripts.

 

Also when I tried Process.Start(acadExe, args) it gives me an error

daltonparrish_0-1647035407502.png

 

0 Likes
Message 4 of 8

SergeLachance
Contributor
Contributor

DONT WORK WITH INVENTOR 2026

0 Likes
Message 5 of 8

Michael.Navara
Advisor
Advisor

Tested in Inv 2026 (+ Acad 2025) and it works.

Check if you don't have whitespace in file name or path. In this case you need to enclose path to double quotes. The same is for script file.

Dim dwgFile = """C:\Path\To\Drawing with whitespace in file name.dwg""" ' "C:\Path\To\Drawing.dwg"

 

@SergeLachance 

When you get some error message, please put it here. Or put here your version of code for reference. Without information I can't help you.

0 Likes
Message 6 of 8

SergeLachance
Contributor
Contributor

Hello, thank for your reply Michael!

 

my problem in this rule is not the drawing, is just to open autocad 2026 with ilogic!

0 Likes
Message 7 of 8

Michael.Navara
Advisor
Advisor

If you want to start another program, you can use Process.Start method. I dnon't have ACAD 2026 installed, but I don't expect any issue.

0 Likes
Message 8 of 8

SergeLachance
Contributor
Contributor

I know that, dont work!

0 Likes