The difference between arrayrect and blocks in storage and reading

The difference between arrayrect and blocks in storage and reading

532868257
Explorer Explorer
396 Views
4 Replies
Message 1 of 5

The difference between arrayrect and blocks in storage and reading

532868257
Explorer
Explorer

I discovered during development that when arrayrect are stored in DWG format, they are ultimately saved as block references. But ordinary blocks are also stored block references. How do I know if I am reading an array or a block? Is there some keyword information that needs to be stored during storage and judged based on these keywords during reading? I've been searching for a long time but haven't found any keywords, so I'm very confused.

 

Can anyone help me solve my confusion? Thank you very much.

397 Views
4 Replies
Replies (4)
Message 2 of 5

Michiel.Valcke
Advisor
Advisor

These are the readouts in DXF (entget (car (entsel))) and VLA (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) of the same ArrayRect:

 

 

((-1 . <Entity name: 219e13b2f70>) (0 . "INSERT") (5 . "287") (102 . "{ACAD_REACTORS") (330 . <Entity name: 219e10c60c0>) (102 . "}") (330 . <Entity name: 219e13b39f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbBlockReference") (2 . "*U3") (10 1638.0 1071.29 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))

 

  

 

; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff6e5024110>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000002198fadda28>
;   EffectiveName (RO) = "*U3"
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "287"
;   HasAttributes (RO) = 0
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000002198eda7c68>
;   InsertionPoint = (1638.0 1071.29 0.0)
;   InsUnits (RO) = "Unitless"
;   InsUnitsFactor (RO) = 1.0
;   IsDynamicBlock (RO) = 0
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "*U3"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AcDbBlockReference"
;   OwnerID (RO) = 43
;   PlotStyleName = "ByLayer"
;   Rotation = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000002198eda7780>
;   Visible = -1
;   XEffectiveScaleFactor = 1.0
;   XScaleFactor = 1.0
;   YEffectiveScaleFactor = 1.0
;   YScaleFactor = 1.0
;   ZEffectiveScaleFactor = 1.0
;   ZScaleFactor = 1.0
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   ConvertToAnonymousBlock ()
;   ConvertToStaticBlock (1)
;   Copy ()
;   Delete ()
;   Explode ()
;   GetAttributes ()
;   GetBoundingBox (2)
;   GetConstantAttributes ()
;   GetDynamicBlockProperties ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   ResetBlock ()
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

 


You have several clues to determine it is an array and not a regular block reference:

the name of the block is anonymous (starts with a * - *U3)

If you look up the name in the block definition table you will not find it, so you can test for that in your routine.

(tblobjname "layer" "*U3")

0 Likes
Message 3 of 5

Michiel.Valcke
Advisor
Advisor

You can ignore my first post, look for the classname with the dumpallproperties:

(dumpallproperties (car (entsel)))

 

Annotative (type: bool)  (LocalName: Annotative) = Failed to get value
AnnotativeScale (type: AcString)  (RO)  (LocalName: Annotative scale) = Failed to get value
AnonymousBlockTableRecord (type: AcDbObjectId)  (RO) = 0
AttributeCollection (type: AcDbObjectId)  (RO)
AxesAngle (type: double)  (LocalName: Included axis angle) = 1.570796
Base/X (type: double)  (LocalName: Base X) = 1638.003639
Base/Y (type: double)  (LocalName: Base Y) = 1071.290822
Base/Z (type: double)  (LocalName: Base Z) = 0.000000
BlockId (type: AcDbObjectId)  (RO) = 219e13b39f0
BlockTableRecord (type: AcDbObjectId) = Failed to get value
BlockTableRecord/BlockScaling (type: AcDbBlockTableRecord::BlockScaling)  (RO) = Failed to get value
BlockTableRecord/Name (type: const ACHAR*)  (RO)  (LocalName: Name) = Failed to get value
BlockTableRecord/PathName (type: const ACHAR*)  (RO) = Failed to get value
BlockTableRecord/UnitFactor (type: double)  (RO)  (LocalName: Unit factor) = Failed to get value
BlockTableRecord/Units (type: AcString)  (RO)  (LocalName: Block Unit) = Failed to get value
BlockTransform (type: AcGeMatrix3d) = ((1.000000 0.000000 0.000000 0.000000)(0.000000 1.000000 0.000000 0.000000) (0.000000 0.000000 1.000000 0.000000) (1638.003639 1071.290822 0.000000 1.000000))
CastShadows (type: bool) = 1
ClassName (type: AcString)  (RO) = AcDbAssociativeRectangularArray
CollisionType (type: AcDb::CollisionType)  (RO) = 1
Color (type: AcCmColor)  (LocalName: Color) = BYLAYER
DynamicBlockReferencePropertyCollection (type: AcDbDynBlockReferenceProperty)  (RO)
DynamicBlockTableRecord (type: AcDbObjectId)  (RO) = 219e13b2f40
ExtensionDictionary (type: AcDbObjectId)  (RO) = 0
ExternalPath (type: AcString)  (RO)  (LocalName: Saved Path) = Failed to get value
Handle (type: AcDbHandle)  (RO) = 287
HasFields (type: bool)  (RO) = 0
HasSaveVersionOverride (type: bool) = 0
Hyperlinks (type: AcDbHyperlink*)
IsA (type: AcRxClass*)  (RO) = AcDbBlockReference
IsAProxy (type: bool)  (RO) = 0
IsCancelling (type: bool)  (RO) = 0
IsComparedReference (type: bool)  (RO) = 0
IsDynamicBlock (type: bool)  (RO) = 0
IsEraseStatusToggled (type: bool)  (RO) = 0
IsErased (type: bool)  (RO) = 0
IsModified (type: bool)  (RO) = 0
IsModifiedGraphics (type: bool)  (RO) = 0
IsModifiedXData (type: bool)  (RO) = 0
IsNewObject (type: bool)  (RO) = 0
IsNotifyEnabled (type: bool)  (RO) = 0
IsNotifying (type: bool)  (RO) = 0
IsObjectIdsInFlux (type: bool)  (RO) = 0
IsPersistent (type: bool)  (RO) = 1
IsPlanar (type: bool)  (RO) = 1
IsReadEnabled (type: bool)  (RO) = 1
IsReallyClosing (type: bool)  (RO) = 1
IsTransactionResident (type: bool)  (RO) = 0
IsUndoing (type: bool)  (RO) = 0
IsWriteEnabled (type: bool)  (RO) = 0
ItemSpacing (type: double)  (LocalName: Column spacing) = 266.786298
ItemSpan (type: double)  (LocalName: Total column distance) = 800.358894
Items (type: int)  (LocalName: Columns) = 4
LayerId (type: AcDbObjectId)  (LocalName: Layer) = 219e13b3900
LayerPropertyOverrides (type: bool)  (RO)  (LocalName: Layer property overrides) = Failed to get value
LevelSpacing (type: double)  (LocalName: Level spacing) = 1.000000
LevelSpan (type: double)  (LocalName: Total level distance) = 1.000000
Levels (type: int)  (LocalName: Levels) = 1
LineWeight (type: AcDb::LineWeight)  (LocalName: Lineweight) = -1
LinetypeId (type: AcDbObjectId)  (LocalName: Linetype) = 219e13b3950
LinetypeScale (type: double)  (RO)  (LocalName: Linetype scale) = 1.000000
LocalizedName (type: AcString)  (RO) = Array (Rectangular)
MatchOrientationToLayout (type: bool)  (LocalName: Match orientation to layout) = Failed to get value
MaterialId (type: AcDbObjectId)  (LocalName: Material) = 219e13b3ec0
MergeStyle (type: AcDb::DuplicateRecordCloning)  (RO) = 1
Normal/X (type: double) = 0.000000
Normal/Y (type: double) = 0.000000
Normal/Z (type: double) = 1.000000
ObjectId (type: AcDbObjectId)  (RO) = 219e13b2f70
OwnerId (type: AcDbObjectId)  (RO) = 219e13b39f0
PlotStyleName (type: AcString)  (RO)  (LocalName: Plot style) = ByColor
Position/X (type: double)  (RO)  (LocalName: Insertion point X) = Failed to get value
Position/Y (type: double)  (RO)  (LocalName: Insertion point Y) = Failed to get value
Position/Z (type: double)  (RO)  (LocalName: Insertion point Z) = Failed to get value
ReceiveShadows (type: bool) = 1
Rotation (type: double)  (LocalName: Rotation) = Failed to get value
RowElevation (type: double)  (LocalName: Row elevation increment) = 0.000000
RowSpacingWithExpression (type: double)  (LocalName: Row spacing) = 318.348203
RowSpan (type: double)  (LocalName: Total row distance) = 636.696405
RowsWithExpression (type: int)  (LocalName: Rows) = 3
ScaleFactors/UniformScale (type: double)  (RO)  (LocalName: Scale) = Failed to get value
ScaleFactors/X (type: double)  (RO)  (LocalName: Scale X) = Failed to get value
ScaleFactors/Y (type: double)  (RO)  (LocalName: Scale Y) = Failed to get value
ScaleFactors/Z (type: double)  (RO)  (LocalName: Scale Z) = Failed to get value
ShadowDisplay (type: AcDb::ShadowFlags)  (RO)  (LocalName: Shadow Display) = Failed to get value
Transparency (type: AcCmTransparency)  (LocalName: Transparency) = 0
TreatAsBlockRefForExplode (type: bool)  (RO) = 0
Type (type: AcString)  (RO)  (LocalName: Type) = Rectangular
Visible (type: AcDb::Visibility) = 0
End object dump

 

 

If you look at the classname, it will tell you it's a AcDbAssociativeRectangularArray

In autolisp you can get that value with (getpropertyvalue ename propertyname)

0 Likes
Message 4 of 5

532868257
Explorer
Explorer

When I  use ODA to read a DWG file containing a arrayrect, the data I received shows that the type of arrayrect is OdDbBlockReference. This is the same type as a regular block. So I always recognize the arrayrect as a block. I don't know how to distinguish them. Because they are both OdDbBlockReference.

0 Likes
Message 5 of 5

Michiel.Valcke
Advisor
Advisor

ODA? What language or tool are you trying to use to read / modify your .dwg?

The above example I'm using is Autolisp. Try to post your question in the customization forums to get help from someone with more experience with the language you are using.

You're apparently looking at the following property, while you should be looking at the ClassName

IsA (type: AcRxClass*)  (RO) = AcDbBlockReference

 

0 Likes