edit clould mark lsp

edit clould mark lsp

nychoe1
Advocate Advocate
240 Views
1 Reply
Message 1 of 2

edit clould mark lsp

nychoe1
Advocate
Advocate

Hello, thank you always.
Below is Cloud Mark Lisp.
It works fine when the crosshair is normal.
however,
with the ucs command
When the crosshair rotates,
A cloud mark is created in an unexpected place.
Even when the crosshair rotates
Please fix it so it works properly.
Thanks for reading.

 

(defun c:clo (/ ds1 plw pt1 pt2 p1 p2 xdist ydist spcsx spcsy ent1 ent2 nxt info bulge data c_o c_l)
    (setq c_o (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 0)
              (setq c_l (getvar "clayer"))                
              (setq ly (tblsearch "layer" "Revision")) 
              (if (= ly nil) (command "layer" "n" "Revision" ""))
              (setvar "clayer" "Revision")                
  (setvar "clayer" c_l)   
(setq ds1 (getvar "dimscale")
plw (* 0.02 ds1)                                            
oer *error*
bm (getvar "blipmode"))
   (if (= ds20200929 nil)
   (setq   ds20200929 (* 30 ds1))
   )
(print)              ; ------------> circle size 
(setq str (strcat "dimscale : <" (rtos ds1 2 0) "> input size  <" (rtos ds20200929 2 0) "> : "))
(setq  buf (getint str)) 
   (if (= buf NIL) 
   (setq buf ds20200929)
   (setq ds20200929 buf)
   )
(or #acwid (setq #acwid 0))
(setq #acwid
       (cond 
  ((getreal(strcat "\nwid<"(rtos #acwid 2 2)"> : ")))
  (#acwid)
)
)   
    (defun *error* (s) ;start error routine
(setvar "blipmode" bm) ;reset blipmode
(princ (strcat "\Exit..." s)) ;type error message
(if oer (setq *error* oer))  
(if c_o (setvar "osmode" c_o)) 
(princ))
(print)
(SETQ PT1 (GETPOINT "p1: ")) (terpri)
(setq pt2 (getcorner pt1 "p2: "))
(setvar "blipmode" 0)
(setq p1 (car pt1) p2 (car pt2) ;find x distances
xdist (- p2 p1))
(setq p1 (cadr pt1) p2 (cadr pt2) ;find y distances
ydist (- p2 p1))
;******TO ADJUST SPACING OF ARCS CHANGE THE NUMBER 2 IN THE NEXT TWO LINES*****
(setq spcsx (/ (abs xdist) (/ ds20200929 2)) ;X spacing
spcsy (/ (abs ydist) (/ ds20200929 2))) ;Y spacing
(if (= spcsx (fix spcsx)) (setq spcsx (fix spcsx)) (setq spcsx (+ 1 (fix spcsx))))
(if (= spcsx 1) (setq spcsx 2)) ;min of 2 spaces
(if (= spcsy (fix spcsy)) (setq spcsy (fix spcsy)) (setq spcsy (+ 1 (fix spcsy))))
(if (= spcsy 1) (setq spcsy 2)) ;min of 2 spaces
(setq xdist (/ xdist spcsx) ydist (/ ydist spcsy)) ;set distances
    (setq p1 (list(car pt1)(cadr pt2)))      
(command "PLINE" p1 "W" #acwid "") 
(repeat spcsx ;draw bottom line segments
(setq p1 (polar p1 0.0 (abs xdist)))
(command p1))
(repeat spcsy ;draw right line segments
(setq p1 (polar p1 (/ pi 2) (abs ydist)))
(command p1))
(repeat spcsx ;draw top line segments
(setq p1 (polar p1 pi (abs xdist)))
(command p1))
(repeat (- spcsy 1) ;draw left line segments
(setq p1 (polar p1 (* pi 1.5) (abs ydist)))             
(command p1))
(command "C") ;Close polyline
(setq ent1 (entlast) ;get entity
ent2 (entget ent1) ;get entity info
;******TO ADJUST THE ARC SIZE ADJUST THE 0.5 BELOW*******
bulge (list (cons 42 0.5)) ;build cloud arcs   0.5
nxt (cdr (assoc -1 ent2)) ;set for lookup
nxt (entnext nxt) ;get next one
plw (list (cons 41 plw))) ;build cloud width
(if (= nxt nil)
(progn
(setq ent2 (subst (cons 42 0.5) (assoc 42 ent2) ent2))
(entmod ent2) ;modify entity
)
(while nxt ;start loop
(setq info (entget nxt) ;get exist. info
info (append info bulge) ;set bulge
info (append info plw) ;set width
) ;end of setq
(entmod info) ;modify entity
(setq nxt (entnext nxt)) ;get next segment
) ;end of while
)
(entupd ent1) ;update entity
(setvar "blipmode" bm) ;reset blipmode
(setvar "cmdecho" 1) ;turn command echo on
              (setvar "osmode" c_o)
              (setvar "clayer" c_l) ;<= 
(gc) (princ) ;print blank line
) ;End program
 

 

0 Likes
241 Views
1 Reply
Reply (1)
Message 2 of 2

LDShaw
Collaborator
Collaborator
I am guessing what you're experiencing is likely due to the use of UCS (User Coordinate System) affecting the way the script interprets the coordinates. When UCS is rotated, the coordinates in your script might not behave as expected because they are still being interpreted in the WCS (World Coordinate System).

Can you tell me if it works like you want if you set your plan to your current ucs?

Command: PLAN

Enter an option [Current ucs/Ucs/World] <Current>:
Regenerating model.

0 Likes