Jump to content

Recommended Posts

Posted

I would like a lisp file that lock down 45 degree increments.

 

The angles I want locked down are as follows:

  • 45°
  • 90°
  • 135°
  • 180°
  • 225°
  • 270°
  • 315°

Is there a way to make a lisp file for something like this?

I'd like to set "DD" as turning this command on and "DD" to turn it off. Is that possible? 

Posted
Just now, ronjonp said:

F10 .. polar tracking:

image.png.c2d868628e5a85f5a93a3f00017d186f.png

I know, but it doesn't lock the 45 degree increments. It also has all the other angles in between the locked angles. 

Posted
1 minute ago, ronjonp said:

F10 .. polar tracking:

image.png.c2d868628e5a85f5a93a3f00017d186f.png

I want something like ortho where it locks the 90 degree increments, but instead of 90 I'd like to lock it at 45 degree increments. 

Posted
2 minutes ago, Lee Mac said:

Enable Polar Tracking and set APERTURE to 50.

This is great! It's the closest thing to what I want. Is there a way to not have any angle in between? If not, then this is fine as well. Thank you!

Posted
20 minutes ago, Lee Mac said:

Enable Polar Tracking and set APERTURE to 50.

So the problem with what I'm seeing is that the snapping also is bumped up quite a lot. Is there any way to keep the snapping to normal?

Posted
9 hours ago, aban said:

So the problem with what I'm seeing is that the snapping also is bumped up quite a lot. Is there any way to keep the snapping to normal?

It's because you have APERTURE set to 50. Type APBOX at the command line and change the setting to 1 and you will see how large the aperture box is when set to 50. With the aperture box set that large, it's going to try and grab everything it gets close to.

Posted
9 hours ago, aban said:

This is great! It's the closest thing to what I want. Is there a way to not have any angle in between? If not, then this is fine as well. Thank you!

I'm still not understanding how you're getting other angles. If you have the polar tracking increment angle set to 45, you should only be seeing 45 degree angle snapping.

Posted
6 hours ago, Cad64 said:

I'm still not understanding how you're getting other angles. If you have the polar tracking increment angle set to 45, you should only be seeing 45 degree angle snapping.

hi, not sure but do you remember similar topic we discussed before? here

IMO perhaps OP's 'locking'  effect like something orthomode or snapmode does?

 

ot45.gif

  • Like 1
Posted
6 hours ago, hanhphuc said:

hi, not sure but do you remember similar topic we discussed before? here

IMO perhaps OP's 'locking'  effect like something orthomode or snapmode does?

 

ot45.gif

This is exactly what I want, where the angles lock at every 45 degree angle. I don't want the turned x and y axis though. I'm looking at the thread, but from the description dlanorh wrote, it seems like I need to draw a circle, arc or ellipse first which I'm not understanding why. I would like what the video shows, so instead of the word "test" at the command line I'd like if I could make it "DD". Also are you writing the different angles in or is it automaticlly going to the 90, 0, 45, 135, 180, etc degrees? I would like it to automatically snap to those degrees. Kind of like ortho, but in this case it's every 45 degree angles. 

 

I've done a little lisp before and have tried to understand that, but for the most part it's very difficult for me.  

 

This is the closest thing to what I want. Thank you!! 

Posted (edited)

i recalled Lee Mac's LM:orthopoint 

;LM:orthopoint (trans method)
;slightly mod

(trans (getvar 'UCSXDIR) 0 1)

;to
(trans (list c c 0.0) 0 1)

where C, equals to (cos (* 0.25 pi))

On 8/24/2018 at 12:56 AM, aban said:

This is exactly what I want, where the angles lock at every 45 degree angle. I don't want the turned x and y axis though. I'm looking at the thread, but from the description dlanorh wrote, it seems like I need to draw a circle, arc or ellipse first which I'm not understanding why. I would like what the video shows, so instead of the word "test" at the command line I'd like if I could make it "DD". Also are you writing the different angles in or is it automaticlly going to the 90, 0, 45, 135, 180, etc degrees? I would like it to automatically snap to those degrees. Kind of like ortho, but in this case it's every 45 degree angles. 

I've done a little lisp before and have tried to understand that, but for the most part it's very difficult for me.  

This is the closest thing to what I want. Thank you!! 

The GIF demo was just theoretically expressed possibility your 'lock' (ortho) behavior at 45d

however we still prefer polarsnap mode which you are able to intersect within objects &  input distance during command active etc..

(defun dd (/ foo p1 p2 p3 a b d grr)
  (setq foo  '(( n / l a) ;octa 
        	(if (< 0.0 n 2.0)
      		     (caar
			(vl-remove-if-not
	  		   '(lambda (x)
	     			(= 1 (vl-position 0 (vl-sort-i (cons n (list (+ (cadr x) 1e-15) (caddr x))) '<=)))
	     			)
	  		     (repeat 9
	    			(setq l (cons (setq	a (if l
				    (mapcar ''((x) (- x 0.25)) a)
				     (cond (a)
					  ('(2.00 1.875 2.125))
					)
				      )
			            )
			          l
			        )
		   	      )
	    	            )
	                  )
	                )
                    0.0
                   )
                 )
    	p1 (getvar 'lastpoint)
	)
  (while (and (setq grr (grread t 13 0)) (= (car grr) 5) (setq p2 (cadr grr)) (vl-consp p2))
    (redraw)
    (setq a  (angle p1 p2)
	  b  (* (foo (/ a pi)) pi)
	  p3 (polar p1 b (* (cos (abs (- b a))) (distance p1 p2)))
	  ) 
    (grdraw p1 p3 1 0)
    (princ (strcat "\rOrtho angle = "
		   (rtos (/ (* b 180.) pi) 2 0)
		   "                                                        "
		   )
	   )
    )
  (terpri)
  ;pause for user input
  (if (setq d (getdist "\nInput distance or <Enter> : "))
    (setq p3 (polar p1 b d))
   )
  (redraw)
  (grdraw p1 p3 1 0)
  p3
  )

;was c:test changed to c:dd
(defun c:dd nil (dd))

The command 'dd' only shows 'lock' effect and returns UCS coordinates nothing than that. 

maybe you can use it as modifier run transparently? Then 'dd' must be  included in brackets, i.e:   (dd) 

Command: pline
Specify start point: 0,0

Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]: (dd)
Ortho angle = 315
(5.09256 -5.09256 0.0)

or customize toolbar with macro: (dd)  ?

Edited by hanhphuc
disabled html syntax color , 1e-8 , getdist
Posted
6 hours ago, hanhphuc said:

i recalled Lee Mac's LM:orthopoint 


;LM:orthopoint (trans method)
;slightly mod

(trans (getvar 'UCSXDIR) 0 1)

;to
(trans (list c c 0.0) 0 1)

where C, equals to (cos (* 0.25 pi))

The GIF demo was just theoretically expressed possibility your 'lock' (ortho) behavior at 45d

however we still prefer polarmode which you are able to intersect within objects &  input distance during command active etc..


(defun dd (/ foo p1 p2 p3 a b grr)
  (setq foo  '(( n / l a) ; octa
    (if	(< 0.0 n 2.0)
    (caar
	(vl-remove-if-not
	  ''( (x)
	     (= 1 (vl-position 0 (vl-sort-i (cons n (list (+ (cadr x) 1e-8) (caddr x))) '<=)))
	     )
	  (repeat 9
	    (setq l (cons (setq	a (if l
				    (mapcar ''((x) (- x 0.25)) a)
				    (cond (a)
					  ('(2.00 1.875 2.125))
					  )
				    )
				)
			  l
			  )
		  )
	    )
	  )
	)
      0.0
      )
    )
    p1 (getvar 'lastpoint))
  (while (and (setq grr (grread t 13 0)) (= (car grr) 5) (setq p2 (cadr grr)) (vl-consp p2))
    (redraw)
    (setq a  (angle p1 p2)
	  b  (* (foo (/ a pi)) pi)
	  p3 (polar p1 b (* (cos (abs (- b a))) (distance p1 p2)))
	  ) ;_ end of setq
    (grdraw p1 p3 7 0)
    (princ (strcat "\rOrtho angle = "
		   (rtos (/ (* b 180.) pi) 2 0)
		   "                                                        "
		   )
	   )
    )
  (redraw)
  (terpri)
  p3
  )

;was c:test changed to c:dd
(defun c:dd nil (dd))

The command 'dd' only shows 'lock' effect and returns UCS coordinates nothing than that. 

maybe you can use it as modifier run transparently? Then 'dd' must be  included in brackets, i.e:   (dd) 


Command: pline
Specify start point: 0,0

Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]: (dd)
Ortho angle = 315
(5.09256 -5.09256 0.0)

or customize toolbar with macro: (dd)  ?

I'm sorry, I'm not the smartest when it comes to lisp language. I understood very little from what you said. I don't know what either lisp command that you posted is. 

 

I don't understand why that command wouldn't allow to input distance? I'm not sure what you mean when you said that with the command you can't intersect within objects. Is it possible to have a command that's exactly like ortho mode, except instead of 90 degree intervals it would be 45 degree intervals? So it would function exactly like ortho, but instead of snapping every 90 degrees it's 45 degrees? And in order to turn it on I wouldn't need to press "F8" I'd have to press "DD"?

 

 

You might have answered my question in your response, but I don't understand what you said. Sorry in advance. I appreciate the help!

Posted (edited)
14 hours ago, aban said:

I don't understand why that command wouldn't allow to input distance? I'm not sure what you mean when you said that with the command you can't intersect within objects.

but you can input distance after while loop , not exactly real time dynamically input distance. Intersect? example LM:grsnap function.

Below snippet code updated in previous post , pause for  user input. 

;snippet
  (terpri)
  ;pause for user input
  (if (setq d (getdist "\nInput distance or <Enter> : "))
    (setq p3 (polar p1 b d))
   )
  (redraw)
  (grdraw p1 p3 1 0)
  p3

Note: when you reply to include code , there's no need to quote the entire code, simply quote as snippet eg:  (defun dd ... ) then understood,  otherwise confusing if the original code gets updated. 

14 hours ago, aban said:

 Is it possible to have a command that's exactly like ortho mode, except instead of 90 degree intervals it would be 45 degree intervals? So it would function exactly like ortho, but instead of snapping every 90 degrees it's 45 degrees? And in order to turn it on I wouldn't need to press "F8" I'd have to press "DD"?

You might have answered my question in your response, but I don't understand what you said. Sorry in advance. I appreciate the help!

IMO as suggested by Ronjonp is suffice, set 45d incremental angle polar tracking , it's not difficult to toggle F8 & F10 during drafting.

why do you insist this ortho 45d ? ortho or polar is just a drafting aid same as my example code which command 'dd' or (dd)

Edited by hanhphuc
Posted

You could set SNAPANG and ORTHOMODE for a toggle.

I too do not see why Polar tracking is so difficult.

  • Funny 1
Posted
4 hours ago, SLW210 said:

You could set SNAPANG and ORTHOMODE for a toggle.

I too do not see why Polar tracking is so difficult.

Snap and with ortho only sets the cursor at 45 degrees and still gives me only 90 degree intervals. I need ORTHO mode, but instead of the line snapping at 90 degree intervals, for example, 90, 180, 270, 360 I want it every 45 degree intervals, 45, 90, 135, 180 and so on. 

 

I use polar tracking now and toggle it with ortho, but for the amount of objects I draw every day it would be much more useful to have this command. I greatly increased my draft time over all by also applying ortho when I already had the 0 and 90 degree tracking for polar tracking. It would greatly benefit me to have this command in one. 

Posted
On 8/24/2018 at 11:57 PM, hanhphuc said:

but you can input distance after while loop , not exactly real time dynamically input distance. Intersect? example LM:grsnap function.

Below snippet code updated in previous post , pause for  user input. 


;snippet
  (terpri)
  ;pause for user input
  (if (setq d (getdist "\nInput distance or <Enter> : "))
    (setq p3 (polar p1 b d))
   )
  (redraw)
  (grdraw p1 p3 1 0)
  p3

Note: when you reply to include code , there's no need to quote the entire code, simply quote as snippet eg:  (defun dd ... ) then understood,  otherwise confusing if the original code gets updated. 

IMO as suggested by Ronjonp is suffice, set 45d incremental angle polar tracking , it's not difficult to toggle F8 & F10 during drafting.

why do you insist this ortho 45d ? ortho or polar is just a drafting aid same as my example code which command 'dd' or (dd)

 

So this is what I put in the lsp file:

 

"(defun c:dd ()


;snippet
  (terpri)
  ;pause for user input
  (if (setq d (getdist "\nInput distance or <Enter> : "))
    (setq p3 (polar p1 b d))
   )
  (redraw)
  (grdraw p1 p3 1 0)
  p3"

 

When I press "DD" in autocad, the insert command starts. This lisp command is not working...What am I doing wrong? 

Posted
4 hours ago, SLW210 said:

You could set SNAPANG and ORTHOMODE for a toggle.

I too do not see why Polar tracking is so difficult.

Another problem with setting snapang with ortho at 45 is that it doesn't give me 90,180,270 degrees. I takes too long to do the snapang every time I want to switch ortho from 45 to 90. If I have the 1 command that turns ortho mode at every 45 degree intervals instead of 90 degree, it will give me exactly what I need for my job. Thank you for the help.

Posted (edited)
On 8/27/2018 at 11:22 PM, aban said:

So this is what I put in the lsp file:

There's no need to alter it since already updated last saturday - try to reload previous code

On 8/27/2018 at 11:22 PM, aban said:

When I press "DD" in autocad, the insert command starts. This lisp command is not working...What am I doing wrong? 

not sure why it starts INSERT command? are you using any vertical product or any custom program installed which may have similar command 'DD'?

In order avoid conflict you just need to replace 'DD' with other unique name 'OO' etc..

(defun c:oo () (dd))

 

it looks like you want to use this alternative orthomode to callaborate with other command,

IMO its lisp limitation? Lisp only can be evaluated once for each command as drafting aid (modifier), it does not active after the next command , $0.02 suggestion - customize toolbar click it to activate.

add macro (c:OO) or (DD) - Important: brackets '(' ')' must be included! 

example:  Test a 'MOVE' command , 'DD' or 'OO' does not work, but works with '(DD)'

Command: move

Select objects: 1 found

Select objects:

Specify base point or [Displacement] <Displacement>: Specify second point or 
<use first point as displacement>: dd

Invalid point.
  
Specify second point or <use first point as displacement>: (dd)
Ortho angle = 315

Specify distance or <Enter> :

 

im not sure but perhaps .NET has more functionalities & possibilities.


or customize command with LISP routine using function (DD), example for drawing lines , command: L45

(defun c:L45	(/ *error* p p2)
;drawing Line which emulates orthomode at 45d 
  (defun *error* (msg) (redraw) (princ "\n*cancel*")) ; minimal trap
  (and (setq p (getpoint "Specify start point : "))
       (while (setq p (setvar 'lastpoint p))
	 (and (setq p2 (dd))
	      (entmakex (list '(0 . "LINE") (cons 10 p) (cons 11 p2)))
	      (setq p p2)
	      )
	 )
     (redraw)
       )
  (princ)
  )

 

Edited by hanhphuc
example code added c:L45
Posted

You should post a sample drawing of what you are drafting This seems like it should be easier IMO. 😜

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...