How to set parameters for AcdbBlockReference?

How to set parameters for AcdbBlockReference?

Anonymous
Not applicable
1,074 Views
2 Replies
Message 1 of 3

How to set parameters for AcdbBlockReference?

Anonymous
Not applicable
Hello, Create a parameters Block, and How to set parameters for AcdbBlockReference?
0 Likes
1,075 Views
2 Replies
Replies (2)
Message 2 of 3

tbrammer
Advisor
Advisor

You have to use class AcDbDynBlockReference. Construct an AcDbDynBlockReference with the objectid of your BREF or with the BREF pointer itself. Then you can query the dynamic property and set them like this:

#include <dbdynblk.h>
 
Acad::ErrorStatus es;
AcDbDynBlockReference dynBref(brefID);
AcDbDynBlockReferencePropertyArray properties;
dynBref.getBlockProperties(properties);
int icount = properties.length();
for (i = 0; i < count; ++i)
{
	AcDbDynBlockReferenceProperty &property = properties[i];
	bool bReadOnly = property.readOnly();
	AcString strName = property.propertyName();
	AcString strDescr = property.description();
	AcDbEvalVariant value(_your_value_); // _your_value_ can be double, short, const ACHAR* ...
	es = property.setValue(value);
}

Keep in mind that AutoCAD will create a different AcDbBlockTableRecord and your BREF will point to this new BTR after you changed parameters.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 3 of 3

Anonymous
Not applicable

thanks, that's exactly what I want.

0 Likes