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

API insert componet

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
417 Views, 3 Replies

API insert componet

I am writing a routine to draw a horizontal wire from the L1and L2 power rails at the top of the ladder and insert a destination signal on each.
Is there a way to insert the signal code and description
with the call?
I currently have the options bit set to 1 to open the edit/insert
dialog box.

Does anyone have any idea's or a better way to do something like this?
Here is the code I have so far.
It's not pretty but it seems to work so far.

(DEFUN C:TO_FROM ()
-OSNAP END
(SETQ L1 (GETPOINT "\nSELECT STARTING L1 COLUMN POINT: "))

(SETQ L2 (GETPOINT "\nSELECT STARTING L2 COLUMN POINT: "))

(SETQ LD 2.5)

(SETQ L1STRTX (CAR L1))
(SETQ L1STRTY (CADR L1))
(SETQ L1ENDPTX (+ LD L1STRTX))
(setq L1pt3 (list L1ENDPTX L1STRTY))
(c:wd_wire L1 L1PT3 "WIRES")
(setq DEST (c:wd_insym2 "HA1D1" L1PT3 nil 1))

(SETQ L2STRTX (CAR L2))
(SETQ L2STRTY (CADR L2))
(SETQ L2ENDPTX (- L2STRTX LD))
(setq L2pt3 (list L2ENDPTX L2STRTY))
(c:wd_wire L2 L2PT3 "WIRES")
(setq new_entname (c:wd_insym2 "HA1D3" L2PT3 nil 1))

)

Thanks for any help

Joe
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Joe,
You're on the right track. Your call to (c:wd_insym2...), if successful,
should return the entity name of the destination signal arrow symbol. You
can then call the (c:wd_modattrval ...) function to push new attribute
values on to it. I've roughed in a couple lines below. See if this gets you
a bit further along.
Nate.

wrote in message news:4873186@discussion.autodesk.com...
I am writing a routine to draw a horizontal wire from the L1and L2 power
rails at the top of the ladder and insert a destination signal on each.
Is there a way to insert the signal code and description
with the call?
I currently have the options bit set to 1 to open the edit/insert
dialog box.

Does anyone have any idea's or a better way to do something like this?
Here is the code I have so far.
It's not pretty but it seems to work so far.

(DEFUN C:TO_FROM ()
-OSNAP END
(SETQ L1 (GETPOINT "\nSELECT STARTING L1 COLUMN POINT: "))

(SETQ L2 (GETPOINT "\nSELECT STARTING L2 COLUMN POINT: "))

(SETQ LD 2.5)

(SETQ L1STRTX (CAR L1))
(SETQ L1STRTY (CADR L1))
(SETQ L1ENDPTX (+ LD L1STRTX))
(setq L1pt3 (list L1ENDPTX L1STRTY))
(c:wd_wire L1 L1PT3 "WIRES")
(setq DEST (c:wd_insym2 "HA1D1" L1PT3 nil 1))

(if DEST
(progn ; signal arrow successfully inserted. Annotate its attributes
with some values.
(c:wd_modattrval DEST "SIGCODE" "HOT_WIRE" nil)
(c:wd_modattrval DEST "DESC1" "120VAC HOT - From power panel LP1"
nil)
) )

(SETQ L2STRTX (CAR L2))
(SETQ L2STRTY (CADR L2))
(SETQ L2ENDPTX (- L2STRTX LD))
(setq L2pt3 (list L2ENDPTX L2STRTY))
(c:wd_wire L2 L2PT3 "WIRES")
(setq new_entname (c:wd_insym2 "HA1D3" L2PT3 nil 1))


(if new_entname
(progn ; signal arrow successfully inserted. Annotate its attributes
with some values.
(c:wd_modattrval new_entname "SIGCODE" "NEUTRAL_WIRE" nil)
(c:wd_modattrval new_entname "DESC1" "120VAC neutral - From power
panel LP1" nil)
) )

)

Thanks for any help

Joe
Message 3 of 4
Anonymous
in reply to: Anonymous

Nate
That worked fine. I changed the sigcode value to match some source signals that I have inserted in my test drawing but the cross ref and wire number are not updating.
I placed the following API call after the Modattrval calls
(c:wd_retag_update_noprompts 1 DEST)
Am I using this call correctly?

Or is there a different call to use. when I click on the dest arrow and right click for the retag/update it works
Message 4 of 4
Anonymous
in reply to: Anonymous

I am using (setq new_entname (c:wd_insym2 "HPB11" (list 14.0041 18.07) nil nil)) to insert a Push button from the command line.  how can I add arguments to this string to change attribute values of the push button on entry?

 

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

Post to forums  

Autodesk Design & Make Report