Jump to content

Autolisp Beginner


seegs

Recommended Posts

Hi all,

 

I have written a few basic autolisp programs now, to test what I have learned so far. My latest one is to draw the outline of a house, with the user entering the width of the house and the pitch of the roof.

The problem is, with this program and the others I have written, when I run it it occasionally messes up. As in, sometimes it will miss drawing some lines or they will be in the wrong place.

If this happened every time then obviously there is a problem in the program. But for it to happen randomly is something i just don't get.

Is this a common thing with beginners?

 

Thanks

Link to comment
Share on other sites

Sounds like you need to write your self a bit of a user program manual and record what variables are being used where and stay consistant not much good making one variable a string in one program and a real in another it will crash, same with selection sets often if you try to make the same named one again it will give an error.

 

You need to work out what combo of steps causes a crash. Sometimes a real bug it can be the zoom factor of the drawing at the time this is a hair pulling problem but once you know about it you can work around it.

Link to comment
Share on other sites

Hi all,

 

The problem is, with this program and the others I have written, when I run it it occasionally messes up. As in, sometimes it will miss drawing some lines or they will be in the wrong place.

If this happened every time then obviously there is a problem in the program. But for it to happen randomly is something i just don't get.

Is this a common thing with beginners?

 

You should put your osnap off before the command "_.line" or "_.polyline" and whatever in your routine .

 

e.g.

(setq os (getvar 'osmode))
(setvar 'osmode 0)
.....
... your commnads and codes here
.....
..
then we reset the osmode as it was before
(setvar 'osmode os)

 

If you use entmake(x) instead of command call that would avoid the osmode settings .:wink:

 

Tharwat

Link to comment
Share on other sites

Thanks for the quick reply guys.

I did know about the osnaps affecting line placement, and I was pretty sure I was getting this problem with osnaps on and off. BUT I just tested my program again and again and everytime I ran with osnaps on the lines went to the wrong place, & vice versa :oops:

 

Cheers :D

Link to comment
Share on other sites

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...