Access P&ID Class properties like Tag, class of a P&ID Object using lisp

Access P&ID Class properties like Tag, class of a P&ID Object using lisp

ArunS2DHBM
Enthusiast Enthusiast
303 Views
3 Replies
Message 1 of 4

Access P&ID Class properties like Tag, class of a P&ID Object using lisp

ArunS2DHBM
Enthusiast
Enthusiast

I want to Access P&ID Class properties like Tag, class of a P&ID Object -instruments using lisp program. I aim to capture the Tag of the instrument and it should automatically update on the corresponding Instrument Loop Number.

I'm Unable to access the Tag of the equipment nor the instrument.
i have given a sample code for capturing the properties-"layer" of Equipment and changing the layer of the instrument. Similar manner i required to capture first the Tag of equipment and the it should update the Instrument Loop Number.

(defun c:UpdateInstrumentLayerFromEquipment ()
(setq equipmentObj (car (entsel "\nSelect the equipment: "))) ; Prompt the user to select the equipment
(if (not equipmentObj)
(progn
(alert "No equipment selected. Please select an equipment.")
(princ)
)
)
(setq equipmentLayer (cdr (assoc 8 (entget equipmentObj)))) ; Get the layer name of the selected equipment
(if (not equipmentLayer)
(progn
(alert "Layer name not found for the selected equipment.")
(princ)
)
)
(setq instrumentObj (car (entsel "\nSelect the instrument: "))) ; Prompt the user to select the instrument
(if (not instrumentObj)
(progn
(alert "No instrument selected. Please select an instrument.")
(princ)
)
)
(command "_.CHPROP" instrumentObj "" "la" equipmentLayer "") ; Change the layer property of the instrument to the equipment's layer
(alert (strcat "Layer of the instrument updated to: " equipmentLayer))
(princ)
)

0 Likes
Replies (3)
Message 2 of 4

h_eger
Mentor
Mentor

Dear @ArunS2DHBM ,

 

This does not work with Lisp!
You need the SDK for Plant 3D

-

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 4

ArunS2DHBM
Enthusiast
Enthusiast

Hi @h_eger 

Can you please explain the method, or how use SDK. if possible, with the required codes for my need.

0 Likes
Message 4 of 4

h_eger
Mentor
Mentor

@ArunS2DHBM ,

 

You can work that out for yourself or buy such a service in your area - I don't have the time for it

 

https://adndevblog.typepad.com/.services/blog/6a0167607c2431970b0162ffdc445e970d/search?filter.q=Pla...

-

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