AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Open Plant drawing from cmd

4 REPLIES 4
Reply
Message 1 of 5
kdaTZK4A
585 Views, 4 Replies

Open Plant drawing from cmd

 

I would like to be able to open a dwg in a project from command line or cmd.

I found a solution to open with a script file as a parameter like this:
acad.exe /product PLNT3D /language "en-US" /b "OpenProject.scr"

The script file opens a project and subsequently a dwg.
filedia 0 openproject "C:\Sandbox 2\Project.Xml" open "C:\Sandbox 2\PID DWG\211.dwg" filedia 1

This works fine when I run the script from Plant
When I start plant from cmd it look like it does what it is supposed to in the Script but with the I get a lot of errors and end up not opening the project or file. Have tried with cmd as admin without success. How do I open a Plant Project and dwg the right way from cmd?

Looks like a permission issue.

 

Tags (1)
Labels (1)
4 REPLIES 4
Message 2 of 5
VictorOrellana
in reply to: kdaTZK4A

I would like to know how to do this too.

I need to open some dwg files in plant3D, execute some commands, and close those files.

Let's see if someone can help us with this.

 

Edit: I can open every dwg file in a folder. First, in cmd I need to be located in the folder where the files I want to open are, using the cd command. Then I execute the following line to open all the dwg files in this folder:

for %F in (*.dwg) do start "" "%F"

 

Now I need to know how to run Autocad commands on each of the files

Message 3 of 5

If your'e not going to use AutoLISP or the .net API, the best option is to use scripting as mentioned above. Here is a link that should help get you started in scripting in AutoCAD:
https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-BE44AE86-7638-48C9-BE5B-C1DF8E4C8808
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 4 of 5
kdaTZK4A
in reply to: matt.worland

Hi Matt,

 

Thank you for replaying.

But it is for Windows Command Line I need a solution to open a dwg file in Plant 3D. I was not to clear about that in the original post I admit.

 

Kasper

Message 5 of 5
matt.worland
in reply to: kdaTZK4A

Hello Kasper,
If you are going to go the route of using the Windows command prompt, your script is most likely the best option. You can see an example here of vanilla AutoCAD using ACCoreConsole. It uses bat and scr files.
https://www.keanw.com/2012/02/the-autocad-2013-core-console.html

AutoCAD has limitations as to what you can do in a Windows Command prompt as well as limitations using AutoLISP in Plant 3D. Using the .net API is the most robust option for manipulating Plant 3D drawings with code. If you are going after basic AutoCAD commands, you can fall back to using a bat file and a script or AutoLISP.
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"

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

Post to forums  

Autodesk Design & Make Report