TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: shaymin on October 17, 2023, 02:49:49 AM

Title: Grread Problem
Post by: shaymin on October 17, 2023, 02:49:49 AM
When I use Grread + grvecs to create a rectangular from point to another point. I can't snap perpendicular. Hope Someone help me solve it
Title: Re: Grread Problem
Post by: dexus on October 17, 2023, 03:34:34 AM
One of the disadvantages of grread is that it doesn't have snap at all.
It is possible to make custom snap functions inside of the grread loop and your code seems to have implemented that in some way, but apparently without implementing the perpendicular snap.

You will have to post the code for anyone to see where this goes wrong.
Title: Re: Grread Problem
Post by: kozmos on October 17, 2023, 04:46:52 AM
When I use Grread + grvecs to create a rectangular from point to another point. I can't snap perpendicular. Hope I help me solve it
During grread loop, add (setq pt (osnap pt "_per")) when you have point from grread.
Title: Re: Grread Problem
Post by: shaymin on October 17, 2023, 05:19:27 AM
One of the disadvantages of grread is that it doesn't have snap at all.
It is possible to make custom snap functions inside of the grread loop and your code seems to have implemented that in some way, but apparently without implementing the perpendicular snap.

You will have to post the code for anyone to see where this goes wrong.
Thank your comment. I used Lee'grnap and it help me catch point like osnapmode but when I use grread it just return a point then it can't catch a penperdicular point so I get here to find a solution
When I use Grread + grvecs to create a rectangular from point to another point. I can't snap perpendicular. Hope I help me solve it
During grread loop, add (setq pt (osnap pt "_per")) when you have point from grread.
Thank your cmt. That my lisp draw a duct I don't know write that code where in my lisp if you have time check it for me
Title: Re: Grread Problem
Post by: BIGAL on October 17, 2023, 08:19:42 PM
Do you really need to draw the rectang ? Why not a line ? Then draw the rectang. Or even mline will draw 2 lines. Can make mlines using entmake.

Code: [Select]
(setq pt1 (getpoint "\start point "))
(setvar 'osmode 128)
(setq pt2 (getpoint pt1 "Point 2"))
Title: Re: Grread Problem
Post by: shaymin on October 17, 2023, 08:56:08 PM
Do you really need to draw the rectang ? Why not a line ? Then draw the rectang. Or even mline will draw 2 lines. Can make mlines using entmake.

Code: [Select]
(setq pt1 (getpoint "\start point "))
(setvar 'osmode 128)
(setq pt2 (getpoint pt1 "Point 2"))
I did that man. If u use my lisp above u will understand. I just want to up size and down size when I draw so I use grread to do that
Title: Re: Grread Problem
Post by: dexus on October 25, 2023, 06:42:06 AM
The perpendicular snap is based on the lastpoint system variable.
So you want to do
Code - Auto/Visual Lisp: [Select]
  1. (setvar 'lastpoint pt1)
before your grread loop.