TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TSQDD on October 08, 2021, 12:42:27 PM
-
Hello,
If anyone can help me, it would be greatly appreciated.
I do a lot of fire alarm systems. My problem is the creation of one line diagrams. I have a routine I use to copy "dynamic" blocks and "annotative" scaling. Problem is it crashes on a block that is dynamic and I end up just copying blocks to the one line and then I have to do the same thing for the room names(mtext). When you have literally hundreds of these to do, it warrants asking for assistance. I have attached the oneline routine and the error trap I use. I understand that things may be done differently in both routines.
So, the ideal situation would be to...
1.) Select a block, or dynamic block "X"
2.) Copy "X" to a oneline point
3.) Next copy of "X" move the point to the right 1.5 x DIMSCALE/ANNOTATIVE SCALE
4.) Select a block, or dynamic block "X"
5.) Repeat until done
Again, I appreciate the help.
Tim
-
Rather than just edit your code here is some suggestions.
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 1) ; set snap to end reset at end of code.
Google "Lee-mac ssget" it is a good reference about using ssget to select objects
(setq ss (ssget "_+.:E:S" '((0 . "INSERT")))) ; select only a block
(setq blk (ssname ss 0))
wrong order
(setq INSPT(list (+ (car INSPT) (* DIMSC 1.50)) (- (cadr INSPT) 0.0)))
(command ".insert" BLK2 INSPT DIMSC DIMSC 0)
I use for add X Y Z to point
(setq INSPT (mapcar '+ INSPT (list (* DIMSC 1.50) 0.0 0.0))))
-
BigAl,
Thanks for the response. In all the years I have been drawing, I am admittedly not a code writer at all. Something I could never wrap my brain around.
I have attached my "attempt" at applying the code suggestion you made to the routine. Unfortunately it crashes.
I appreciate your help. This is something that will take me 2 days to complete via old school ways and was worthy of the attempt. It is ok, in a way, because I am paid by the hour, however, as mudane as it is, was worth the shot.
Thank you.
-
I would suggest download Notepad++ it has a lisp checker mode, I opened your code in vlide and got Extra right parenthis, so looked in Notpead++ checking match ( ) as they change colour to red so can see where wrong. Dont have extra defun (reset) so no test.
Anyway
(RESET)
(princ)
) remove
-
BigAl,
I have used Notepad++ for years. I am just not a coder.
Thanks again.