• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

lisp to select solids with same properties

  • Thread starter Thread starter lorenzo94
  • Start date Start date

lorenzo94

Guest
is there a possibility to make a lisp to select solids according to their volume (or a kind of "select similar" but take into account only the volume of solids)? Thank you.
 
you can select all solids with ssget, then, for each, extract the volume value with
(vla-get-volume (vlax-ename->vla-object) <ename>)
and then with cycle compare each solid volume with the comparison value.</ename>
 
I have no autocad on the pc from which I answer.
more or less do so:

1 - request volume value to be searched (setq vol_limite(getreal))

2 - select all solids (setq sss(sget "x"((0 . "3dsolid")))))

3 - creates a cycle in which for each entity of the selection group sss
extract the volume and compare it with the value of point 1.
(setq k 0 list_solidi()))
(repeat)
(setq e(ssname k sss) vol(vla-get-volume (vlax-ename->vla-object e))))
in case of equality add solid ename to a list
(if (= vol_limite)(setq list_solidi(cons and list_solidi))))

(setq k(1+ k))
....

in the end you will have a list <ename> of solids and then it is easy to pass them to a selection command



4.</ename>
 
OK thanks, but not knowing very well the lisp language is hard for me. Couldn't you throw down a draft? Thank you so much!
 
great! But instead of choosing the value to compare by clicking on the solid directly I have to insert it manually. can't you make sure that the reference value is selected directly by clicking on a solid?
 
Replace:
(setq vol_rif (getreal "\nvalore volume:"))

with:
(setq vol_rif(vla-get-volume))))

Comunue... I allow myself to tell you that learning to solve small computer problems alone is a very rewarding thing.
you do it by reading (books, help and web tutorials) and trying and retrying.
but this is just my opinion.
 
I know, in fact I already plan with arduino and I know it well, it is that I needed urgently, but surely I will start to study lisp, since I discovered its usefulness! Thank you very much
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top