Plot a p&id symbol using python

Plot a p&id symbol using python

ss6153
Enthusiast Enthusiast
2,072 Views
10 Replies
Message 1 of 11

Plot a p&id symbol using python

ss6153
Enthusiast
Enthusiast

Hello reader
I want to know if its possible to plot a p&id symbol(such as gate valve, instrument bubble, etc) using python in autocad. I have been trying to work with pyautocad but I dont think  AutoCAD Plant symbols can be plotted by using it. Is there a way to use pyautocad to plot a symbol?

Or anything similar to pyautocad for AutoCAD Plant specifically? 

 

If not the above then is there a way I can run autocad commands using python or anything else, that will lead to the plotting of a symbol in the dwg? (Maybe AutoLISP?) 

Please help....

0 Likes
2,073 Views
10 Replies
Replies (10)
Message 2 of 11

h_eger
Mentor
Mentor

If you can explain to me what you want to do with pyAutoCAD in Plant 3D P&I, I can give you an answer if necessary.

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



0 Likes
Message 3 of 11

George.Endrulat
Advisor
Advisor

You'll have to write a wrapper for the plant 3d sdk in python to make it accessible and useable.  The same would have to happen if you want to manipulate plant 3d in lisp or vba.  I don't know of any wrappers that are current for 2021/22/xx.  If you do end up writing one please please share it here.

 

George

If my post offers a solution, please click "Accept as Solution"
Message 4 of 11

ss6153
Enthusiast
Enthusiast

Hi @h_eger 
I want to write a program using pyautocad, that will make autocad plot a symbol (ex: gate valve) on the p&id drawing.

0 Likes
Message 5 of 11

ss6153
Enthusiast
Enthusiast

Hello @George.Endrulat 
Thanks for your response..
Will doing what you suggested, allow me to plot a symbol in the p&id sheet programatically?
If yes, do you have any inputs for how I should go about writing the wrapper?

0 Likes
Message 6 of 11

h_eger
Mentor
Mentor

@ss6153 ,

 

Drawing P&ID symbols will probably be the easier task, but how do you want to connect these drawn symbols to the database?

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



0 Likes
Message 7 of 11

ss6153
Enthusiast
Enthusiast

@h_eger I am new to using autocad plant
In fact, i have been working with the sample p&ids that are provided with Autocad
so im not sure what it means to connect a symbol to the database 

@h_egerand @George.Endrulat  you have answered some of my other questions as well, so maybe if i explain my entire problem statement to you, you might be able to guide me
I have a json file which has all data from a p&id(image) such as the symbol name, the coordinates, etc
I want to use this data and plot the p&id in autocad where autocad can recognise the symbols, lines, etc

 

Initially I tried to convert image to vector form and open it in autocad, but autocad treats everything in it as a polyline... even the text is created out of polylines.

Then I asked in the autocad community if it was possible to plot a p&id from textual data and @h_eger replied saying it was not possible.
So now I am trying to use something like pyautocad or AutoLISP that can trigger AutoCAD commands to plot the symbols from the data.
To achieve the above I first need to check if its possible to plot AT LEAST a symbol (ex: gate valve, pump) in autocad drawing using pyautocad or LISP.

 

 I do not have the option to give up. If the aproach I'm taking now doesn't work then I'll try something else. 


I hope that the above explains what im trying to achieve a little better.
Please share any ideas or inputs you may have.

0 Likes
Message 8 of 11

h_eger
Mentor
Mentor

Full stop!
you ended up not in the AutoCAD forum but in the AutoCAD Plant 3D forum.

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



0 Likes
Message 9 of 11

jabowabo
Mentor
Mentor

EDIT: If you do actually just want to plot/print a drawing from raw data, ignore my post below. I thought you wanted to replicate an intelligent P&ID.

 

Python and/or LISP won't get you there. You'll need to use the .NET API (or maybe ObjectARX) to do anything like what you are describing if you want to create a fully-functioning intelligent P&ID. You won't find a lot of documentation on this and I'd consider it a difficult task for even an expert in the P&ID application and API to replicate an entire P&ID accurately from raw data. But, if you don't have the option to 'give up', you should start by looking here: https://www.autodesk.com/developer-network/platform-technologies/autocad-p-id-and-plant-3d

Message 10 of 11

ss6153
Enthusiast
Enthusiast

@h_eger  I did not understand your reply at all.. 

0 Likes
Message 11 of 11

h_eger
Mentor
Mentor

Dear @ss6153 ,

 

You are in the wrong forum
When posting should be created here;

https://forums.autodesk.com/t5/autocad-forum/bd-p/706 

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



0 Likes