jonhite Posted August 13, 2018 Share Posted August 13, 2018 We often need 15/16" tall rectangles at different lengths. I want to be able to select point a and point b and create a 15/16" tall rectangle perpendicular to the line between the 2 points (no line is needed, just he rectangle) I also want it to appear on the Defpoints later every time. I know very basics of LISP code, but I'm very much learning. Thanks for any help! Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted August 13, 2018 Share Posted August 13, 2018 Command RF for 15, RS for 16 I presume your dwg is in inch. Otherwise it will simply use 15 or 16 of whichever active units (defun LWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) (defun deg2rad (deg / ) (/ (* deg 3.14159265359 ) 180) ) ;; rfs for Rectangle Fifteen (defun c:rf ( / pa pb baseheading) (setq pa (getpoint "\nPoint A: ")) (setq pb (getpoint "\nPoint B: ")) (setq baseheading (angle pa pb)) (setq pc (polar pa (+ baseheading (deg2rad 90)) 15)) (setq pd (polar pb (+ baseheading (deg2rad 90)) 15)) (LWPoly (list pa pb pd pc) 1) ) ;; rs for Rectangle Sixteen (defun c:rs ( / pa pb baseheading) (setq pa (getpoint "\nPoint A: ")) (setq pb (getpoint "\nPoint B: ")) (setq baseheading (angle pa pb)) (setq pc (polar pa (+ baseheading (deg2rad 90)) 16)) (setq pd (polar pb (+ baseheading (deg2rad 90)) 16)) (LWPoly (list pa pb pd pc) 1) ) Quote Link to comment Share on other sites More sharing options...
jonhite Posted August 13, 2018 Author Share Posted August 13, 2018 *Defpoints layer every time Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted August 13, 2018 Share Posted August 13, 2018 oh yes. See if this does the trick ;; draws a polyline on layer "DEFPOINTS" (defun LWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 "DEFPOINTS") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) Quote Link to comment Share on other sites More sharing options...
jonhite Posted August 13, 2018 Author Share Posted August 13, 2018 Sorry, I'm being a poor American. Yes it is in Inches. 15/16" = .9375 inches. I just need 1 of that height and to be placed on the Defpoints layer every time. Sorry to be confusing. Quote Link to comment Share on other sites More sharing options...
tombu Posted August 13, 2018 Share Posted August 13, 2018 *Defpoints layer every time Please read: https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/sfdcarticles/sfdcarticles/Putting-objects-on-non-plot-layer.html?st=defpoints%20layer and: https://forums.autodesk.com/t5/autocad-forum/defpoints/m-p/2297321 Many issues related to users using this layer whose sole purpose is for dimension nodes. Use a layer set to Not Plot instead. Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted August 13, 2018 Share Posted August 13, 2018 Okay, like this? Command RFS ;; draws a polyline on layer "DEFPOINTS" (defun LWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 "DEFPOINTS") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) (defun deg2rad (deg / ) (/ (* deg 3.14159265359 ) 180) ) ;; rfs for Rectangle Fifteen/Sixteen (defun c:rfs ( / pa pb pc pd baseheading) (setq pa (getpoint "\nPoint A: ")) (setq pb (getpoint "\nPoint B: ")) (setq baseheading (angle pa pb)) (setq pc (polar pa (+ baseheading (deg2rad 90.0)) (/ 15.0 16.0) )) (setq pd (polar pb (+ baseheading (deg2rad 90.0)) (/ 15.0 16.0) )) (LWPoly (list pa pb pd pc) 1) ) Quote Link to comment Share on other sites More sharing options...
jonhite Posted August 13, 2018 Author Share Posted August 13, 2018 Perfect, thank you! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 14, 2018 Share Posted August 14, 2018 Emmanuel a couple of suggestions (* deg 3.14159265359 ) (* deg PI ) (deg2rad 90.0) (setq a90 (/ pi 2.0)) (setq pc (polar pa (+ baseheading a90) (/ 15.0 16.0) )) 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.