nil28 Posted January 29, 2019 Share Posted January 29, 2019 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 30, 2019 Share Posted January 30, 2019 (edited) 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 January 30, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
nil28 Posted February 7, 2019 Author Share Posted February 7, 2019 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 Quote Link to comment Share on other sites More sharing options...
nil28 Posted February 11, 2019 Author Share Posted February 11, 2019 Hello all, Please help someone. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 12, 2019 Share Posted February 12, 2019 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) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.