Access P&ID Class properties like Tag, class of a P&ID Object using lisp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
)