Solved

Reading constant properties from an AutoCAD block

  • 20 November 2018
  • 6 replies
  • 8 views

Badge

Is it possible to read constant properties from an Autocad block?

Constant properties are never changing in a block and can be displayed.

 

This is an example:

It shows 1 block, with some dynamic attributes ('12 345'). The 'N' is a constant property, so there is no attribute defining it.

My questions is: is there somehow a way to read this information?

I am aware it is possible to explode the block and extract this autocad_text entity, but that is not the solution I am after.

 

icon

Best answer by daveatsafe 20 November 2018, 19:19

View original

6 replies

Badge +3

@jneujens

 

If you read the block and explode it into entities.

The elements can be read. You can see this in the Feature Information Window.

To access these properties, you need to expose the relevant schema attributes.

 

The "N" in the block is a text object: autocad_text_string (encoded: UTF-16LE): N.

Apart from the text value itself I see no way to select it, you probably have to test or regexp the text strings to do that.

Badge

@jneujens

 

If you read the block and explode it into entities.

The elements can be read. You can see this in the Feature Information Window.

To access these properties, you need to expose the relevant schema attributes.

 

The "N" in the block is a text object: autocad_text_string (encoded: UTF-16LE): N.

Apart from the text value itself I see no way to select it, you probably have to test or regexp the text strings to do that.

In the question I already literally stated I aware of this solution. Because of external constraints it is not possible to explode the block.

Userlevel 2
Badge +17

Hi @jneujens,

The 'N' is part of the graphical content of the block, rather than an attribute, so there is no way to extract it without exploding the block.

However, the N will always be present if the block LEMD is placed, so you can infer its presence from autocad_block_name. I assume that if there is a corresponding 'S' block, it will have a different name.

Userlevel 4
Badge +25

In the question I already literally stated I aware of this solution. Because of external constraints it is not possible to explode the block.

True but you could add another reader to read that layer a second time, this time exploding the block; then use a NeighborFinder to transfer the information from the exploded block (which you then discard) onto the unexploded version.

Badge

@jneujens

 

If you read the block and explode it into entities.

The elements can be read. You can see this in the Feature Information Window.

To access these properties, you need to expose the relevant schema attributes.

 

The "N" in the block is a text object: autocad_text_string (encoded: UTF-16LE): N.

Apart from the text value itself I see no way to select it, you probably have to test or regexp the text strings to do that.

Mark2AtSafe ♦♦ Absolutely true, but in some cases that slows down the process more than I would like to unfortunately.

 

Thanks for both answers though!
Badge

Hi @jneujens,

The 'N' is part of the graphical content of the block, rather than an attribute, so there is no way to extract it without exploding the block.

However, the N will always be present if the block LEMD is placed, so you can infer its presence from autocad_block_name. I assume that if there is a corresponding 'S' block, it will have a different name.

DaveAtSafe Probably yes, although I do not always know what to expect beforehand...

 

 

Thanks for the clarification!

Reply