Rectangle Using Snapang

Rectangle Using Snapang

tinouye42
Explorer Explorer
855 Views
8 Replies
Message 1 of 9

Rectangle Using Snapang

tinouye42
Explorer
Explorer

I regularly use dview twist and snapang to rotate my drawings but I've found the rectangle command doesn't use the new snap angle and just defaults to no rotation. Can someone help me write a new rectangle command that uses the current snap angle? Thanks in advance!

0 Likes
Accepted solutions (1)
856 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend

@tinouye42 wrote:

I regularly use dview twist and snapang to rotate my drawings...


Turn on the variable UCSFOLLOW (look it up in HELP if needed for more information) and RECTANG will follow your DVIEW>TWIST choices all the time.

 

 

0 Likes
Message 3 of 9

pkenewell6347
Advocate
Advocate

Try using the rotated option of the RECTANG command rather than using snapang:

(defun C:RREC (/ p1 p2)
   (setq p1 (getpoint "Select First Corner Point: ")
         p2 (getangle p1 "Enter a Value or Select Second Point to define Angle: <0>")
         p2 (if p2 p2 0.0)
   )
   (command "._rectang" "_non" p1 "_r" "_non" (pjk-rtd p2))
   (princ "\n")
   (while (= (logand (getvar "cmdactive") 1) 1)
      (command pause)
   )
   (princ)
)

 

0 Likes
Message 4 of 9

tinouye42
Explorer
Explorer

Thanks for the quick replies!

I did some testing with ucsfollow and it seems to set plan to current when defining a UCS. However I'm trying to maintain WCS by using dview twist instead, so ucsfollow doesn't seem to help. Or am I missing something?

 

The rotated option of the RECTANG command works just fine but I guess I was hoping there was a way to skip the part where the user defines the angle, and instead have it automatically pull from the snapang.

0 Likes
Message 5 of 9

pendean
Community Legend
Community Legend

@tinouye42 wrote:

...However I'm trying to maintain WCS by using dview twist instead...


May I ask why?

 


@tinouye42 wrote:

...I was hoping there was a way to skip the part where the user defines the angle, and instead have it automatically pull from the snapang.


There are many out there, here is one (ORTHOMODE if you want it to follow your SNAPANG setting for example)

https://www.theswamp.org/index.php?topic=3725.msg44961#msg44961 

 

 

 

0 Likes
Message 6 of 9

pkenewell6347
Advocate
Advocate
Accepted solution

Hmm - try this?

 

 

(defun C:RREC (/ p1 an)
   (setq p1 (getpoint "Select First Corner Point: ")
         an (* (/ (getvar "snapang") pi) 180.0)
   )
   (command "._rectang" "_non" p1 "_r" an)
   (princ "\n")
   (while (= (logand (getvar "cmdactive") 1) 1)
      (command pause)
   )
   (princ)
)

 

 

0 Likes
Message 7 of 9

tinouye42
Explorer
Explorer

I'm not a fan of UCS since it causes issues with insertion points (xref overlays, copy base) and obscures the true rotation of objects. I know you can just reset to WCS but I feel like using dview twist saves me a few seconds here and there.

Thank you both! The RREC command works perfectly!

Message 8 of 9

Sea-Haven
Mentor
Mentor

Not sure if its my Bricscad but needed this moved "R" option, Added getpoints.

 

 

(command "rectang" "R" (getpoint "\nPick point 1 ")(getpoint "\nPick point 2") an)

 

   I use my multi getvals.lsp for this type of thing so could do a short hand defun that defines the angle eg R60, R45. and use the in code above. It would just ask for length and width if by distance.

 

SeaHaven_0-1715741494617.png

maybe 

 

(defun c:rect60 ( / ang)
(setvar 'angdir 1)
; (setvar 'aunits 1) ; may be needed
(command "rectang" "R" (getpoint "\nPick point 1 ")(getpoint "\nPick point 2") 60)
(princ)
)

 

0 Likes
Message 9 of 9

TomBeauford
Advisor
Advisor

I only use Lee Mac's 3-Point Rectangle lisp for drawing rectangles which works under all UCS & View settings.

https://www.lee-mac.com/3pointrectangle.html

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes