Jump to content
nil28

insert 2 attributed blocks in one command one by one

Recommended Posts

nil28

I am using below program, but I want to update this program for the below
- in same command (CONDT), once I place the symbol "CONDUIT_", again it will ask me place the another block for which I will give the insertion point. e.g. attached CONDUIT_LEFT block I will get first then it will ask me to provide the insertion point & ask me give the two more attributes. Then "CONDUIT_DTLS" block will come. "TXT" attribute will same for both "CONDUIT_LEFT" & "CONDUIT_DTLS" block.

 

(defun c:CONDT (/ T_Rotation T_Point)
(setq Adia (getvar 'ATTDIA))
(setq Areq (getvar 'ATTREQ))
(setq Pf (getvar 'PICKFIRST))
(setvar 'PICKFIRST 1)
(setvar 'ATTDIA 0);;Required to feed Attribute values without a dialog box
(setvar 'ATTREQ 1);;Required for Turns on prompts or a dialog box for attribute values
(setvar 'CMDECHO 0)
(setq txt (getstring "\nYour text content for the Attribute: "))
   (while (setq T_Point (getpoint "Enter the point of insertion"))
    (initget 1 "Right Left Up Down")
    (setq T_Rotation (getkword "\nSelect Rotation [Right/Left]: "))
    (vl-catch-all-apply 'vl-cmdf
              (list "_.insert" (strcat "CONDUIT_" T_Rotation) T_Point 1 1 0 txt)
    )
    (sssetfirst nil (ssget "L"))
    (C:BURST)
   )
(setvar 'PICKFIRST Pf)
(setvar 'ATTDIA Adia)
(setvar 'ATTREQ Areq)
(setvar 'CMDECHO 1)
(princ)
)


Thanks for the help!

CONDUIT_DTLS.dwg

CONDUIT_LEFT.dwg

Share this post


Link to post
Share on other sites
BIGAL

It may be easiset to make a new defun for the other insert, then just run the two defuns one after the other. You also turn off the attribute input and turn it back on 0 & 1 ?


(defun condt2 ( / )

(c:condt)

(c:condtls)

)

Edited by BIGAL

Share this post


Link to post
Share on other sites
nil28

I am trying to make program for "condtls" command, I want "CONDUIT_DTLS" block to be used by using this program which has 3 attributes. This command is like after giving command it will ask user to enter the point to place the block then it will ask to enter Text for attribute "DTLS1" & "DTLS2". For "Txt" attribute value should be same as which we have already provided in first "condt" program. I was trying to make below program for this but I am very bad in it so it is not working. Please help.
(defun c:condtls (/ T_Point Txt DTLS1 DTLS2)
(vl-load-com)
(setq Areq (getvar 'ATTREQ))
(setvar 'ATTREQ 0)
(setvar 'CMDECHO 0)
(if (= (setq DTLS1 (getstring T "\nYour text content for the DTLS1 Attribute: ")) "") (setq DTLS1" ")

         (setq DTLS2 (getstring T "\nYour text content for the DTLS2 Attribute: ")) "") (setq DTLS2" "))
   (while (setq T_Point (getpoint "Enter the point of insertion"))
        (vl-catch-all-apply 'vl-cmdf
              (list "_.insert" "CONDUIT_DTLS" T_Point 1 1 0)
    )
    (setq obj (vlax-ename->vla-object (entlast)))
    (foreach att (vlax-invoke Obj 'GetAttributes)
       (if (= (vla-get-Tagstring att) "DTLS1") (vla-put-textstring att DTLS1))
       (if (= (vla-get-Tagstring att) "DTLS2") (vla-put-textstring att DTLS2))
       (if (= (vla-get-Tagstring att) "TXT") (vla-put-textstring att Txt))
    )
       )
(setvar 'ATTREQ Areq)
(setvar 'CMDECHO 1)
(c:burst)
(princ)
)

CONDUIT_DTLS.dwg

Share this post


Link to post
Share on other sites
nil28

Hello all, Please help someone. Thanks in advance!

Share this post


Link to post
Share on other sites
BIGAL

A couple of things you have localised txt so it will reset put it as variable to be passed (defun c:condtls (txt / T_Point DTLS1 DTLS2) BUT you must check that TXT exists before calling  so c:condtls rename it 

 


(defun condtls2 (txt / T_Point DTLS1 DTLS2)

existing code

)

 

(defun c:condtls (/ )

(if (= txt nil)(getstring "enter txt string"))

(condtls2 txt)

)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×