Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp only drawing object correctly when it's not in full view

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
717 Views, 2 Replies

Lisp only drawing object correctly when it's not in full view

Hi,

 

I have the following lisp that is meant to insert a rectangle with chamfered corners, and then insert a smaller concentric rectangle with fillet corners.

 

It works - sort of. If the rectangles it draws are completely on the display for some reason it draws the second rectangle from the chamfer to chamfer of the first rectangle. But if you are zoomed in and you can't see full rectangles, it draws the second rectangle correctly.

 

Does anyone know why this happens?

When I query the p3 and p4 variables after it draws the rectangles incorrectly, it has the right values but for some reason it isn't using these points to draw the second rectangle.

 

Thanks in advance,

Stein.

 

(defun c:reo ( / thk wth cov lig vert numv p p1 p2 p3 p4 dcl_id rad )

(setq dcl_id (load_dialog "sections.dcl"))
(if (not (new_dialog "section" dcl_id)
)
(exit)
)
(action_tile "thk" "(setq thk $value)")
(action_tile "wth" "(setq wth $value)")
(action_tile "cov" "(setq cov $value)")
(action_tile "lig" "(setq lig $value)")
(action_tile "vert" "(setq vert $value)")
(action_tile "numv" "(setq numv $value)")
(action_tile
"cancel"
"(done_dialog) (setq userclick nil)"
)
(action_tile
"accept"
"(done_dialog)(setq userclick T)"
)
(start_dialog)
(unload_dialog dcl_id)
(if userclick
(progn
)
)
(setcfg "AppData/reo/thk" thk)
(setcfg "AppData/reo/wth" wth)
(setcfg "AppData/reo/cov" cov)
(setcfg "AppData/reo/lig" lig)
(setcfg "AppData/reo/vert" vert)
(setcfg "AppData/reo/numv" numv)

(setq rad (* 3 (atoi lig)))
(setq p (getpoint "\nSpecify insertion point: "))
(setq p1 p)
(setq p2 (list (+ (car p1) (atoi wth))(+ (cadr p1) (atoi thk))))
(setq p3 (list (+ (car p1) (atoi cov))(+ (cadr p1) (atoi cov))))
(setq p4 (list (- (car p2) (atoi cov))(- (cadr p2) (atoi cov))))
(command "rectang" "c" "12" "12" p1 p2)
(command "rectang" "f" rad p3 p4)
)rectangles.PNG

2 REPLIES 2
Message 2 of 3
Ranjit_Singh1
in reply to: Anonymous

I do not see any issues. Maybe object snap is causing problems? You have not posted the dcl file so cannot test the code.

Message 3 of 3
Anonymous
in reply to: Ranjit_Singh1

Object snap is the culprit. Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report