How could I fetch the block and entity information ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How could I fetch the block and entity information ?

Johnson
When I open a dxf file ( which contains many blocks and line entitys),

I want to know each information (color ,vector ) of objects for
1. all entities
2. all blocks

I notice that RS_Graphic -> RS_BlockList blockList might fetch the block list ?
                  RS_GraphicView -> RS_EntityContainer* container; // Holds a pointer to all the enties

are these the collection of all entities and all blocks ?  if that,  I am just confused why not there are defined in one class .

BTW,  I want to change the color by programming.  how to do that ?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How could I fetch the block and entity information ?

Rallaz
First, read my comment:
http://forum.librecad.org/Block-can-not-be-inserted-on-different-layers-td5544026.html#a5544807

If you want to write a plugin, you can modify a bit "list plugin" and you have what you need.
Reply | Threaded
Open this post in threaded view
|

Re: Re: How could I fetch the block and entity information ?

Johnson
Hi Rallaz
 
Would you take a look at this dxf ?
 
it contains :
1. several blocks (which composed by a text and a rect )
2. several line which connect different blocks.
 
I want to change the color of each blocks or lines as I wanted by programming.  I will use block name such as "159-124...." to find the block. is it reasonable ? then change the color of the blocks(actually it's just a entity container , I might change the color of the four line and a text together. do you know how to change the color of block rather than change the color of each individual )
 
another question is that
if the colors of rect is changed , the near line color will be changed. do you know how to check whether the line touch the rect or not ?
 
Thanks.  
 

wingame82
 
Date: 2012-12-20 19:24
Subject: Re: How could I fetch the block and entity information ?
First, read my comment:
http://forum.librecad.org/Block-can-not-be-inserted-on-different-layers-td5544026.html#a5544807

If you want to write a plugin, you can modify a bit "list plugin" and you have what you need.


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/How-could-I-fetch-the-block-and-entity-information-tp5707314p5707315.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from How could I fetch the block and entity information ?, click here.
NAML

=?gb2312?B?Qc/gsuLK1MH3s8zNvC5keGY=?= (22K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: How could I fetch the block and entity information ?

Johnson
test.dxf

attachment.
Reply | Threaded
Open this post in threaded view
|

Re: Re: How could I fetch the block and entity information ?

Rallaz
In reply to this post by Johnson
Hi Johnson,

by parts...

Johnson wrote
I will use block name such as "159-124...." to find the block. is it reasonable ?
Is Ok, I do not see any problem.

Johnson wrote
another question is that if the colors of rect is changed , the near line color will be changed. do you know how to check whether the line touch the rect or not ?
Ckecking Xline - Xinsert < 1e5 etc. is easy. The problem is that access to the boundary of "block definition" is not implemented in plugins (you can implement it and send a patch :-)  )

Johnson wrote
change the color of the blocks(actually it's just a entity container , I might change the color of the four line and a text together. do you know how to change the color of block rather than change the color of each individual )
A "block" (block definition) is the same as a document or drawing (entity container)
A "insert" is a entity, a reference to "block" (block definition)
when you add a block in the drawing  you are adding an "insertion" (like a C pointer)

If you change the color of the entities which form the block, then all inserts change =>BAD
A "insert" is a entity with color, linetype etc. if you change the color of the "insert" only
this "insert" change the color => GOOD

The problem (and the solution) is

On draw a "insert" the sequence are:

red insert -> black line in "block" -> draw a black line
red insert -> bylayer line in "block" -> line in yelow layer -> draw a yelow line
red insert -> byblock line in "block" -> insert is red -> draw a red line
and...
bylayer insert -> byblock line in "block" -> insert in blue layer -> draw a blue line

That is, a powerful "block definition" have all the entities in layer 0 & color, linetype & width "byblock"
Attached a dxf to demostrate.


check "sameprop plugin" (Edit->Same properties) this plugin changes layer, color, linetype & width.


Rallaz
Reply | Threaded
Open this post in threaded view
|

Re: Re: How could I fetch the block and entity information ?

Rallaz
Sorry, forgot attachment

blocktest.dxf
Reply | Threaded
Open this post in threaded view
|

Re: Re: How could I fetch the block and entity information ?

Johnson
In reply to this post by Rallaz
Thanks very much .Rallaz
 
I will try that and will let you know the result . Thanks again !
 

wingame82
 
Date: 2012-12-21 03:14
Subject: Re: Re: How could I fetch the block and entity information ?
Hi Johnson,

by parts...

Johnson wrote
I will use block name such as "159-124...." to find the block. is it reasonable ?
Is Ok, I do not see any problem.

Johnson wrote
another question is that if the colors of rect is changed , the near line color will be changed. do you know how to check whether the line touch the rect or not ?
Ckecking Xline - Xinsert < 1e5 etc. is easy. The problem is that access to the boundary of "block definition" is not implemented in plugins (you can implement it and send a patch :-)  )

Johnson wrote
change the color of the blocks(actually it's just a entity container , I might change the color of the four line and a text together. do you know how to change the color of block rather than change the color of each individual )
A "block" (block definition) is the same as a document or drawing (entity container)
A "insert" is a entity, a reference to "block" (block definition)
when you add a block in the drawing  you are adding an "insertion" (like a C pointer)

If you change the color of the entities which form the block, then all inserts change =>BAD
A "insert" is a entity with color, linetype etc. if you change the color of the "insert" only
this "insert" change the color => GOOD

The problem (and the solution) is

On draw a "insert" the sequence are:

red insert -> black line in "block" -> draw a black line
red insert -> bylayer line in "block" -> line in yelow layer -> draw a yelow line
red insert -> byblock line in "block" -> insert is red -> draw a red line
and...
bylayer insert -> byblock line in "block" -> insert in blue layer -> draw a blue line

That is, a powerful "block definition" have all the entities in layer 0 & color, linetype & width "byblock"
Attached a dxf to demostrate.


check "sameprop plugin" (Edit->Same properties) this plugin changes layer, color, linetype & width.


Rallaz



If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/How-could-I-fetch-the-block-and-entity-information-tp5707314p5707318.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from How could I fetch the block and entity information ?, click here.
NAML