Hello, The code below is part of a larger program which I am having trouble with one aspect since upgrading to 2021 from 2013. The issue is on the "SDX" COND part. Im being prompted to enter the scale where I wasnt before. Im able to set the rotation but Im losing the layer part which is working on the other CONDs and the program is not finishing after I insert the block. I guess this is a syntax issue or maybe I need something else for that COND. The difference between the SDX and others is I need to be able to set the rotation of the SDX but not the others.
(command "layer" "off" "*" "n" "m" "PLUMBING" "")
(setq pt_ins (osnap pt_temp2 "mid"))
(IF (null typ)
(PROGN (INITGET "SDX MDX Superflow AquaStar")
(SETQ TYP (COND ((GETKWORD "\nSpecify Main Drain [SDX/MDX/Superflow/AquaStar] <AquaStar>: "))
("AquaStar")
))))
(COND
((= TYP "Superflow")
(if pt_ins
(progn
(vl-cmdf "-INSERT" "PE_DRAIN-SUPERFLOW" pt_ins "1" "1" (angtos (angle pt_temp1 pt_temp2)) "2" "2" "0" "0"))))
((= TYP "SDX")
(if pt_ins
(progn
(vl-cmdf "-INSERT" "PE_DRAIN-SDX" pt_ins "S" 1 PAUSE PAUSE)))) ;;2021 fix scale prompt and dosent finish
((= TYP "MDX")
(if pt_ins
(progn
(vl-cmdf "-INSERT" "PE_DRAIN-MDX3" pt_ins "1" "1" (angtos (angle pt_temp1 pt_temp2)) "2" "2" "0" "0"))))
((= TYP "AquaStar")
(if pt_ins
(progn
(vl-cmdf "-INSERT" "PE_DRAIN-AquaStar" pt_ins "1" "1" (angtos (angle pt_temp1 pt_temp2)) "2" "2" "0" "0"))))
)
I had a similar issue with some dimensioning programs and worked it out by adding this:
(while (> (getvar 'CMDACTIVE) 0) (command pause))
but this did not help with this problem. Thanks for looking.
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
@murmanator hi,
first i reformat the code to make it easy for me to read, hope you don't mind 😀
second i think the problem is in "PE_DRAIN-SDX" block something with it's definition or attributes existent so without seeing it, can not exactly tell
Moshe
(defun c:xxx (/ insert_block ; local function
savAttdia savAttreq)
(defun insert_block (bname flag)
(if pt_ins
(if flag
(vl-cmdf "._insert" bname pt_ins "_s" 1 pause pause)))) ;;2021 fix scale prompt and dosent finish
(vl-cmdf "._insert" bname pt_ins 1 1 (angtos (angle pt_temp1 pt_temp2)) 2 2 0 0)
)
)
); insert_block
; here start c:xxx
(setq savAttdia (getvar "attdia"))
(setq savAttreq (getvar "attreq"))
(setvar "attdia" 0)
(setvar "attreq" 1)
(command "._layer" "_off" "*" "_make" "PLUMBING" "")
(setq pt_ins (osnap pt_temp2 "mid"))
(if (null typ)
(progn
(initget "SDX MDX Superflow AquaStar")
(if (not (setq typ (getkword "\nSpecify Main Drain [SDX/MDX/Superflow/AquaStar] <AquaStar>: ")))
(setq typ "AquaStar")
)
(cond
((= typ "Superflow")
(insert_block "PE_DRAIN-SUPERFLOW" nil)
)
((= typ "SDX")
(insert_block "PE_DRAIN-SDX" t) ;;2021 fix scale prompt and dosent finish
)
((= typ "MDX")
(insert_block "PE_DRAIN-MDX3" nil)
)
((= typ "AquaStar")
(insert_block "PE_DRAIN-AquaStar" nil)
)
); cond
); progn
); if
(setvar "attdia" savAttdia)
(setvar "attreq" savAttreq)
(princ)
); c:xxx
Not saying there isnt something wrong with the block but this program works perfectly in 2013. Thats why I was thinking syntax issue and/or I just need something else in there for the pause part. In any case I have attached the block.
Can't find what you're looking for? Ask the community or share your knowledge.