Jump to content

Problem with Lisp in autocad 2008 (2004 is ok)


firavolla

Recommended Posts

(setq myCount nBare)
(setq myRadius (/ dBare 2.0))
(setq px (polar    pe0 (dtr 315.0) (* myRadius (sqrt 2.0)))
)
(setq D (- bGrinda (* aBeton 2))
)
(setq dist (/ (- D dBare) (- nBare 1))
)
   
(repeat myCount
   (command "circle" px myRadius "")
   (setq px (polar    px (dtr 0) dist)
   )
)

 

 

This code works ok on Autocad 2004, but on 2008 the drawing isn't ok at all. This lump of code is supposed to draw a number of nBare circles (the number is given by the user from inside a simple dialogue) of diameter dBare, equally distanced from one another and sittuated between 2 points.

For this, as you can see, i set up my first point and then in each itteration i draw the associated circle and reset the point.

In autocad 2004, the results, as i said, are ok..but in 2008 the circles are drawn nowhere where they are supposed to be. The first circle is ok, but all the others are gathered where the last one should be. Any ideas? I'm kinda' bumping my head on this one for about 2 hours now..

Link to comment
Share on other sites

Are your OSnaps on?

 

(setq myCount nBare)
(setq myRadius (/ dBare 2.0))
(setq px (polar pe0 (dtr 315.0) (* myRadius (sqrt 2.0))))
(setq D (- bGrinda (* aBeton 2)))
(setq dist (/ (- D dBare) (- nBare 1)))

(repeat myCount
 [color=Red](command "_.circle" "_non" px myRadius "")[/color]
 (setq px (polar px (dtr 0) dist)
 )
)

Link to comment
Share on other sites

Replace the circle command call line with the following; should speed things up a bit.

 

(entmake (list '(0 . "CIRCLE") (cons 10 px) (cons 40 myRadius)))

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