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)) )
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)) )
@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.
@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.
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!
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.