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

Apparent Intersection randomly not working in LISP program

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
425 Views, 2 Replies

Apparent Intersection randomly not working in LISP program

Anonymous
Not applicable

I've been teaching myself LISP over the past couple months, and I am writing a program that will automatically place ordinate dimensions on multiple lines at once. Currently I have it set up so the user is first prompted to select a point for the UCS. Almost all of our parts have chamfers on the zero corner, so I usually use Ctrl+Right Click to use Apparent Intersection, but sometimes when I run the program and use Ctrl+Right Click+Apparent Intersection, it will place the UCS at the endpoint of one of the lines instead of the intersection. This only happens sometimes, maybe 5-10% of the time, while other times it works correctly. It's in an IF statement so if the user presses ENTER without selecting a point it will use the current UCS. Anybody have any ideas on whats going on?

 

(if (setq ZERO (getpoint "\nSelect origin or <ENTER>: "))
	(command "_.UCS" "N" ZERO "")
	(setq ZERO '(0.0 0.0 0.0))
)

 

0 Likes

Apparent Intersection randomly not working in LISP program

I've been teaching myself LISP over the past couple months, and I am writing a program that will automatically place ordinate dimensions on multiple lines at once. Currently I have it set up so the user is first prompted to select a point for the UCS. Almost all of our parts have chamfers on the zero corner, so I usually use Ctrl+Right Click to use Apparent Intersection, but sometimes when I run the program and use Ctrl+Right Click+Apparent Intersection, it will place the UCS at the endpoint of one of the lines instead of the intersection. This only happens sometimes, maybe 5-10% of the time, while other times it works correctly. It's in an IF statement so if the user presses ENTER without selecting a point it will use the current UCS. Anybody have any ideas on whats going on?

 

(if (setq ZERO (getpoint "\nSelect origin or <ENTER>: "))
	(command "_.UCS" "N" ZERO "")
	(setq ZERO '(0.0 0.0 0.0))
)

 

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

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... I have it set up so the user is first prompted to select a point for the UCS. .... when I run the program and use Ctrl+Right Click+Apparent Intersection, it will place the UCS at the endpoint of one of the lines instead of the intersection. ...

 

(if (setq ZERO (getpoint "\nSelect origin or <ENTER>: "))
	(command "_.UCS" "N" ZERO "")
	(setq ZERO '(0.0 0.0 0.0))
)

 


Might you have any running Object snap mode(s) on?  If you use the APParent INTersection mode, that's what will go into the ZERO variable regardless of any running Osnap mode(s).  But when that is used in the UCS command, any running Osnap mode(s) will go into effect if any Osnappable points are within reach of the Aperture box size.

 

Try:
  ... "_.UCS" "N" "_none" ZERO ...

or if this is part of something longer for which maybe it's appropriate for other reasons, have the routine turn Osnap off before it gets to this point.

 

Whenever something doesn't happen as expected in a positional way, especially when it does sometimes but not always, Object Snap is the first thing to look into.

Kent Cooper, AIA


@Anonymous wrote:

... I have it set up so the user is first prompted to select a point for the UCS. .... when I run the program and use Ctrl+Right Click+Apparent Intersection, it will place the UCS at the endpoint of one of the lines instead of the intersection. ...

 

(if (setq ZERO (getpoint "\nSelect origin or <ENTER>: "))
	(command "_.UCS" "N" ZERO "")
	(setq ZERO '(0.0 0.0 0.0))
)

 


Might you have any running Object snap mode(s) on?  If you use the APParent INTersection mode, that's what will go into the ZERO variable regardless of any running Osnap mode(s).  But when that is used in the UCS command, any running Osnap mode(s) will go into effect if any Osnappable points are within reach of the Aperture box size.

 

Try:
  ... "_.UCS" "N" "_none" ZERO ...

or if this is part of something longer for which maybe it's appropriate for other reasons, have the routine turn Osnap off before it gets to this point.

 

Whenever something doesn't happen as expected in a positional way, especially when it does sometimes but not always, Object Snap is the first thing to look into.

Kent Cooper, AIA
Message 3 of 3
Anonymous
in reply to: Kent1Cooper

Anonymous
Not applicable

I thought I had used (command "_OSMODE" 0) right before the if statement, but after double checking I had a 1 instead of a 0. I changed it to 0 and it worked fine. I also tried using "_none" and it worked as well. Thanks!

0 Likes

I thought I had used (command "_OSMODE" 0) right before the if statement, but after double checking I had a 1 instead of a 0. I changed it to 0 and it worked fine. I also tried using "_none" and it worked as well. Thanks!

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