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

MIssing points while render scropt

6 REPLIES 6
Reply
Message 1 of 7
netremo
337 Views, 6 Replies

MIssing points while render scropt

Hello all!

 

Need help. Sory for my english. 

 

I want tp write my first programm with autolisp. I use Autocad 2012(rus). When I run my script I see that some of points are missed in the autocad. Maybe I do something wrong?

 

(setq RB 300)
(setq RM 70)
(setq N 12)
(setq M 11)
(setq I 0)
(setq J 0)
(defun alphai (i)
  (/ (* (/ (* 360 i) N) PI) 180)
)

(defun gammaj (j)
  (/ (* (/ (* 360 j) M) PI) 180)
)


(defun XIJ (I J)
  (* (+ (* RM (cos (alphai I))) RB) (cos (gammaj J)))
)

(defun YIJ (I J)
  (* (+ (* RM (cos (alphai I))) RB) (sin (gammaj J)))
)

(defun zij (I J)
  (* RM (sin (alphai I)))
)

(setq I 0)
(setq J 0)
(setq PT0 (list 0 0 0))

(setvar "CMDECHO" 0)
(repeat	M

  (repeat N

    (setq PT (list (XIJ I J) (YIJ I J) (ZIJ I J)))

    (command "_point" PT)

    (setq I (+ I 1))

    (setq PT0 PT)
  )
  (setq I 0)
  (setq J (+ J 1))
)

 

 

 

Thanks, friends!!!

6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: netremo

netremo

you have to turn off osnap first, try something like

 

(setq osm_old (getvar "OSMODE" ));stores the osmode value in a variable

(setvar "OSMODE" 0);assigns osmode the value 0 "non"

 

your code here...

 

(setvar "OSMODE" osm_old);restore old value

 

 

Your points are in the drawing, if you select are 132 points, but overlapping...

 

Henrique

EESignature

Message 3 of 7
scot-65
in reply to: hmsilva

PICKBOX also works.

 

 

 

 

 

VVV  What's with all these icons???  VVV


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


Message 4 of 7
hmsilva
in reply to: scot-65

scot-65,

 

from help:

when PICKBOX is set to 0,selection previewing of objects is not available.

 

I try set PIKBOX to 0 and the result is the same... points overlapping.

Iis there any value to set PICKBOX that disables the osnap?

 

Henrique

EESignature

Message 5 of 7
Kent1Cooper
in reply to: scot-65


@scot-65 wrote:

PICKBOX also works.

....


If it's a question of Object Snap interfering, I wonder whether you don't mean APERTURE [the size of the Object-snap "find-and-snap-to" window] rather than PICKBOX [the size of the object-selection window].  If have a lot of routines in which I temporarily set the APERTURE System Variable equal to the PICKBOX one [which is, by default at least, much smaller], so that with User selection of an object, I can apply Osnap to the selection point, and feel reasonably sure that the APERTURE size won't reach out and find some other object passing nearby that might have a closer result for the particular Osnap mode.  In other words, setting APERTURE to a very small value can help to avoid Object-snapping to the wrong place, whereas I wouldn't think PICKBOX would have any effect on that.

 

EDIT:  But come to think of it, given what the OP's routine does, a small APERTURE value would not make any difference, if NODE happens to be among the Osnap modes that are running.  Some of those locations coincide in X and Y coordinates, and differ only in Z coordinate.  So if NODE Osnap is on, at least if you're in WCS plan view, placing the second one of a pair of those XY-coinciding points is going to snap it to the same place as the first one.  Turning Osnap off, or at least taking the Node mode out of its value, or maybe better yet, making them with (entmake) instead of the Point command, would be necessary.

Kent Cooper, AIA
Message 6 of 7
Kent1Cooper
in reply to: hmsilva


@hmsilva wrote:

....you have to turn off osnap first, try something like

 

(setq osm_old (getvar "OSMODE" ));stores the osmode value in a variable

(setvar "OSMODE" 0);assigns osmode the value 0 "non"

 

your code here...

 

(setvar "OSMODE" osm_old);restore old value

....


If it is running Object Snap that is causing the problem, in a case like this it's probably simpler to just "turn it off" at the placing of the Points, with the None Object-Snap mode.  That avoids the need to save the OSMODE value, set it to 0, and restore it later.  You can not bother with any of that if you change this line:

 

(command "_point" PT)

 

to this:

 

(command "_point" "_none" PT)

 

Or use (entmake), which is not affected by Object Snap settings, instead of (command).

Kent Cooper, AIA
Message 7 of 7
hmsilva
in reply to: Kent1Cooper

Kent Cooper,

In this case, using the osnap none is enough, but I usually set osnapmode to 0 in my codes,

whenever I need to draw objects using command.

It is an habit, maybe not very correct...

 

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost