Getiing entities from blocks

Status
Not open for further replies.

Darius Blaszijk

Usenet Archive
Joined
Dec 24, 2001
Messages
5
Reaction score
0
Hi,

I have made several blocks witch themselves hold other blocks. When I was making the blocks I have reserved a layer for a special type of block. This way, when I print only this layer I can actually see the frame work I'm working on. What I now want to do is to export this block (actually position) to a file together with other data. I want to use tokens per item type I export. The problem now is that when I make all other layers invisible I actually see what I intended, but when I make a selection like:

(setq mysel (ssget "x" '((8 "frame")))

I get an empty selection. Thereforer I tried:

(setq mysel (ssget "x" '((2 "frameblk")))

But this only gave me one entity. The blocks that are included in other blocks that have been inserted did not show up in the selection. How can I get around this problem?? I don't want to explode all blocks, unless in memory.

Kind regards, Darius Blaszijk
 
IF I understand you correctly, you'd basically have to search through all nested blocks to find the info you're looking for.

I'm not sure what type of data you're looking to export, but it's quite possible that another method of storing/retrieving the data would work much better. Have you considered extended entity data and/or XRrecords?

Darius Blaszijk wrote:

Hi,

I have made several blocks witch themselves hold other blocks. When I was making the blocks I have reserved a layer for a special type of block.
This
way, when I print only this layer I can actually see the frame work I'm working on. What I now want to do is to export this block (actually position) to a file together with other data. I want to use tokens per
item
type I export. The problem now is that when I make all other layers invisible I actually see what I intended, but when I make a selection
like:
(setq mysel (ssget "x" '((8 "frame")))

I get an empty selection. Thereforer I tried:

(setq mysel (ssget "x" '((2 "frameblk")))

But this only gave me one entity. The blocks that are included in other blocks that have been inserted did not show up in the selection. How can I get around this problem?? I don't want to explode all blocks, unless in memory.

Kind regards, Darius Blaszijk
 
Hi Tom,

I'll try to be more specific;

I have made a block with basically only a circle and some attributes. With this circle-block I have made another block; I have made a block out of the original circle-block together with some other entities like lines etc. Anyway, this new block is inserted into a drawing just as the circle-bloc is. When I do ssget with a layer filter (circle-block uses it's own unique layer) I get a result set with length 1 this means that it has only seen the circle-block itself and not the circle-blocks inside the other block. What I want to export is the center coordinates of all the circle blocks (wether alone or used in another block) to a file.

Can you help me with this??

Kind regards, Darius Blaszijk

"TomD" wrote:

IF I understand you correctly, you'd basically have to search through all nested blocks to find the info you're looking for.

I'm not sure what type of data you're looking to export, but it's quite possible that another method of storing/retrieving the data would work
much
better. Have you considered extended entity data and/or XRrecords?

Darius Blaszijk wrote:

> Hi,
>
> I have made several blocks witch themselves hold other blocks. When I
was
> making the blocks I have reserved a layer for a special type of block. This
> way, when I print only this layer I can actually see the frame work I'm
> working on. What I now want to do is to export this block (actually
> position) to a file together with other data. I want to use tokens per item
> type I export. The problem now is that when I make all other layers
> invisible I actually see what I intended, but when I make a selection like:
>
> (setq mysel (ssget "x" '((8 "frame")))
>
...
I
> get around this problem?? I don't want to explode all blocks, unless in
> memory.
>
> Kind regards, Darius Blaszijk
>
>
 
Your syntax is incorrect. You should use
(setq mysel (ssget "x" '((8 . "frame"))))

"(" and ")" must be equal in number, and there must be a " . " (space dot space) in your (ssget) qualifier.
___

"Darius Blaszijk" wrote:

Hi,

I have made several blocks witch themselves hold other blocks. When I was making the blocks I have reserved a layer for a special type of block.
This
way, when I print only this layer I can actually see the frame work I'm working on. What I now want to do is to export this block (actually position) to a file together with other data. I want to use tokens per
item
type I export. The problem now is that when I make all other layers invisible I actually see what I intended, but when I make a selection
like:
(setq mysel (ssget "x" '((8 "frame")))

I get an empty selection. Thereforer I tried:

(setq mysel (ssget "x" '((2 "frameblk")))

But this only gave me one entity. The blocks that are included in other blocks that have been inserted did not show up in the selection. How can I get around this problem?? I don't want to explode all blocks, unless in memory.

Kind regards, Darius Blaszijk
 
No, but ... one thing at a time.
___

"TomD" wrote:

That still wouldn't find nested blocks, would it?

Paul Turvill wrote:

> Your syntax is incorrect. You should use
> (setq mysel (ssget "x" '((8 . "frame"))))
>
> "(" and ")" must be equal in number, and there must be a " . " (space
dot
> space) in your (ssget) qualifier.
> ___
>
> "Darius Blaszijk" wrote:
>
> > Hi,
> >
> > I have made several blocks witch themselves hold other blocks. When I was
> > making the blocks I have reserved a layer for a special type of block.
<SNIPPED>
 
The only thing I can do is offer you some guidance. I intentionally stay away from they scenario you've described for this exact reason. I'm not a programmer, so doing that type of programming is difficult for me to accomplish, even though it may be quite easy for someone with more experience reading through block information.

Before I make any suggestions, be aware that I'm assuming the 'circle blocks' you're trying to access are never nested more than one level deep in a block. By that, I mean you never have a 'circle-block' in a block, contained in yet another.

You'll have to wade through the objects of each block you find looking for objects on the layer in question. I pasted in some code below. It's actually a modified version of a function I use to get attribute values from blocks. I chopped and modified it rather quickly, so there is likely a mistake or two in it. The main point, for you, being that you'll need to use ENTNEXT to step through each object of the 'main' blocks and check for the data you are seeking.

;iname would be the entity name of the block to check for your 'circle block' (setq ename (entnext iname)) (if ename (while (/= etyp "SEQEND") (if (= (cdr (assoc 8 (entget ename))) "CircleBlockLayer") (progn ;your code would need to be here, getting coords and whatever else );progn );if );while );if val )

It's been a while since I've used attribute extraction, but that's another possibility. I'm not sure that it will work on nested blocks, but it would be worth looking into. If you need further help, re-post or feel free to

Darius Blaszijk wrote:

Hi Tom,

I'll try to be more specific;

I have made a block with basically only a circle and some attributes. With this circle-block I have made another block; I have made a block out of
the
original circle-block together with some other entities like lines etc. Anyway, this new block is inserted into a drawing just as the circle-bloc is. When I do ssget with a layer filter (circle-block uses it's own unique layer) I get a result set with length 1 this means that it has only seen
the
circle-block itself and not the circle-blocks inside the other block. What I want to export is the center coordinates of all the circle blocks (wether alone or used in another block) to a file.

Can you help me with this??

Kind regards, Darius Blaszijk

"TomD" wrote:

> IF I understand you correctly, you'd basically have to search through
all
> nested blocks to find the info you're looking for.
>
> I'm not sure what type of data you're looking to export, but it's quite
> possible that another method of storing/retrieving the data would work much
> better. Have you considered extended entity data and/or XRrecords?
>
> Darius Blaszijk wrote:
>
> > Hi,
> >
> > I have made several blocks witch themselves hold other blocks. When I ...
I'm
> > working on. What I now want to do is to export this block (actually
> > position) to a file together with other data. I want to use tokens per
> item
> > type I export. The problem now is that when I make all other layers
> > invisible I actually see what I intended, but when I make a selection
> like:
> >
> > (setq mysel (ssget "x" '((8 "frame")))
> >
> > I get an empty selection. Thereforer I tried:
> >
> > (setq mysel (ssget "x" '((2 "frameblk")))
...
other
> > blocks that have been inserted did not show up in the selection. How
can
I
> > get around this problem?? I don't want to explode all blocks, unless
in
> > memory.
> >
> > Kind regards, Darius Blaszijk
> >
> >
>
>
 
That still wouldn't find nested blocks, would it?

Paul Turvill wrote:

Your syntax is incorrect. You should use
(setq mysel (ssget "x" '((8 . "frame"))))

"(" and ")" must be equal in number, and there must be a " . " (space dot space) in your (ssget) qualifier.
___

"Darius Blaszijk" wrote:

> Hi,
>
> I have made several blocks witch themselves hold other blocks. When I
was
> making the blocks I have reserved a layer for a special type of block.
<SNIPPED>
 
LOL...........point well taken, but that kinda implied that the syntax would solve the problem.

That's one thing I do like about your replies, Paul: Noone could accuse of being long winded. ;)

Paul Turvill wrote:

No, but ... one thing at a time.
___

"TomD" wrote:

> That still wouldn't find nested blocks, would it?
>
> Paul Turvill wrote:
>
> > Your syntax is incorrect. You should use
> > (setq mysel (ssget "x" '((8 . "frame"))))
> >
...
I
> was
> > > making the blocks I have reserved a layer for a special type of
block.
> <SNIPPED>
 
Status
Not open for further replies.

Latest threads

Back
Top