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

Problem with Coords stored in variables

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
800 Views, 5 Replies

Problem with Coords stored in variables

Short version:  when told to draw a line from ptxx (a var containing x and y coords) AutoCAD starts from some point other than what is stored in ptxx.....sometimes

 

Long version:

Program to draw a fairly simple shape of 20 points connected with lines or even 1 pline.  Program runs perfectly one to several times in a row then draws something unexpected one or several times.  Seems to be random and after much effort I can not isolate any event that seems to cause this.  Rewrote the program a couple times in different ways only to get the same result.  Now I think it may not be the program and maybe my system.

 

Turning off all local declarations and running the program until it does something unexpected, and then...

 

From the command line:  !pt10 , !pt11 , !pt12 ,OR !pt13 returns (13.0 16.0) , (13.0 13.0) , (16.0 13.0) , (16.0 12.375) respectively.  These are 4 separate pts with different values and all correct as to what would be expected from the code generating them.

 

Now from the command line:  (command "line" some-point) using pt10, 11, 12, or 13  ALL FOUR start the line command at the first point of (16.0 13.0).  The correct location for only pt12.

 

What am I missing?

 

Ideas?

 

Running AutoCAD Architectural 2011 with no other known bugs on a decent machine with Windows 10.

Code is attached

Acceptable shapes drawn is attached.  Size and chamfer distance may vary

 

Thanks

5 REPLIES 5
Message 2 of 6
CodeDing
in reply to: Anonymous

@Anonymous ,

 

Just at a brief glance, you should ALWAYS ALWAYS turn off your osnaps before drawing lines automatically. This may be affecting your drawing. Try turning them off before drawing lines...

(setq osm (getvar 'OSMODE))
(setvar 'OSMOSE 0)

...then restore them after lines have been drawn...

(setvar 'OSMODE osm)

Best,

~DD

 


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 3 of 6
Anonymous
in reply to: CodeDing


Awesome.  Thanks for the quick response.

 

I have not coded it yet, just turned off Osnap and shazam everything worked as planned.  Will add the code to get current value, set to 0 and reset to original for Osmode.  Thanks again.  

Message 4 of 6
dbhunia
in reply to: Anonymous


@Anonymous wrote:

Awesome.  Thanks for the quick response.

 

I have not coded it yet, just turned off Osnap and shazam everything worked as planned.  Will add the code to get current value, set to 0 and reset to original for Osmode.  Thanks again.  


 

You also can do it without turned off Osnap ....... Like this......."yelloHelp-1.lsp"

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 5 of 6
Anonymous
in reply to: dbhunia

Great, thanks.

 

Message 6 of 6
scot-65
in reply to: Anonymous

Add 16384 to the current OSMODE value and it becomes suppressed.
After command execution check to see if OSMODE is greater than
16384 and if true, subtract 16384 from the OSMODE value.

Why?
A: If program somehow terminates unexpectedly, the user can simply
restore the object snap by clicking the icon on the status line...

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


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