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

counting blocks inside a polyline

  • Thread starter Thread starter zintonio
  • Start date Start date

zintonio

Guest
Hello.
I have to count blocks within well-defined design parts that can be twisted by polylines. Have you ever seen such a thing?
exists a lisp that somehow manages to count all the blocks in a polynea or in a portion of drawing?
Thank you.
 
is the same if you use ssget in the lisp.

unless the polylines you speak of have particloar characteristics and you want to select only the blocks present within them............in that case you always use ssget but insert filters related to polylinese

bb
 
the selwp command returns the number of blocks within the polyline.
to use ssget with polylinea you must first create a list of the coordinates of the polylinea vertices, then recall the ssget function with the wp parameter and filter the insert entities.

bye
 

Attachments

thank you all,

on the rpor66 lisp there is an undefined command:

(setq n (car) (sing "select polyline: "))); the "sing" command perhaps you wanted to insert prompt?

x blubossa, sometimes polylines are irregular polygons and therefore ssget is not enough. What do you mean by inserting polyline filters? Can you give me an example?

Thank you.
 
Excuse me.
add it to the file I had attached.

; function requiring to select the entity. uses entsel function.
(defun sing (prompt / a)
(while (not (setq a (entsel prompt)))
(setq a)
)
 
thanks rpor66 for the answer,

I tried to make it right.
(setq n (car) (sing "select polyline: (i))) (setq n (car (entsel "select polyline: ")
And I have to say it works.
putting the function sing, previously posted, gives me a mistake:
command: selwp
select Polyline: ; error: string in wrong ssget mode

I wanted to ask what you wanted to do with the sing function instead of using an entsel.

Thank you.
 
I updated the file lisp, integrated with the function sing.
the entsel function is also used by sing, the difference is in the fact that sing imposes you to select an entity, if you click empty does not interrupt, which instead entsel does not control, returning nil if you miss the selection.

bye
 

Attachments

I'm sorry, I was wrong to analyze the lisp!

the thing that gave error is (setq sset (ssget "wp" l (list (cons 0 "insert"))).
 
continues to give the following error:
command: selwp
select Polyline: ; error: string in wrong ssget mode

even when I run (setq sset (ssget "wp" l (list (cons 0 "insert")))))
gives the same error

Thank you.
 
I did some evidence, and I went to see the language guide lisp....

the right command is: (setq sset (ssget "_wp" l (list (cons 0 "insert"))))

was missing the underscore (_wp) in front of wp.
 
Sorry again rpor66,

which means (list (cons 0 "insert")) in the final part of the command (setq sset (ssget "_wp" l (cons 0 "insert"))) ?

What is "insert"?
 
insert stands for blocks, those you look for.
practically (cons 0 "insert")) is the filter to the selected entities.
Are you wondering why insert and not block?
block is the definition of the block, stored in the block table (tblsearch "block" [Flag]), insert is the reference to the block.

bye
 
Okay thank you very much rpor66.

from how I understood "insert" or "block" are the same commands when entering and defining blocks respectively. Right?

to have more information, or a guide on which to read and understand the filter on the selected entities, where can I go?

Thank you.
 
Let's say yes.
the help of the visual lisp seems to me well, look at them, if not enough, look for google ssget, find examples and explanations also in Italian.

bye
 
Good morning, everyone, excuse the intrusion. . I'm new to the forum. I tried to use the lisp posted by rpor66 but I can't make it work. Can you tell me where I'm wrong?
I do not have much familiarity, but the procedure I use is to load the lisp and then call selwp from the command bar. I charge it, it tells me to select the polyline but when I do the command disappears. . .

Thank you.
 
the command writes a command number, immediately after the command you launched, which would be the number of blocks present within the polyline.

bye
 
Thanks for the answer. Unfortunately, that's not what I need... let's see if I can explain myself and if you can help me. . .
inside my polylinea I have a tot of blocks, here I would like to understand if there is a way to click on the polylinea and extract the characteristics of the blocks found inside. Is that possible? or do I need to create groups and then do data extraction?

Thank you very much
 
download the attached file, in addition to the number of blocks creates the selection group, which you can use with other commands through the _previous instruction.

bye
 

Attachments

Forum statistics

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

Members online

No members online now.
ciao
Back
Top