.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PropertyTypeCode Enum

6 REPLIES 6
Reply
Message 1 of 7
hgasty1001
1598 Views, 6 Replies

PropertyTypeCode Enum

Hi,

 

Want to know if someone has decoded PropertyTypeCode property of DynamicBlockReferenceProperty? It seems 5 is used for visibility states, 1 for position and angular parameters, 12 for origin, but that's it almost all i have so far.

 

Gaston Nunez

6 REPLIES 6
Message 2 of 7
Balaji_Ram
in reply to: hgasty1001

Hi,

 

Any specific reason for needing those value in your code ?

 

If you can provide me the usage, I can find out from my colleagues to see if they have any information on this.

 

Thank you.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 7
hgasty1001
in reply to: Balaji_Ram

Hi,

 

Thanks for answer, I was not aware that I had to have a reason to ask. Any way,  my question was answered by Alexander Rivilis in The swamp, and the answer was to look at acdbabb.h in the Inc folder of the SDK, that file send me to acdb.h, and that file has:

 

enum DwgDataType       { kDwgNull            = 0,
                             kDwgReal            = 1,
                             kDwgInt32           = 2,
                             kDwgInt16           = 3,
                             kDwgInt8            = 4,
                             kDwgText            = 5,
                             kDwgBChunk          = 6,
                             kDwgHandle          = 7,
                             kDwgHardOwnershipId = 8,
                             kDwgSoftOwnershipId = 9,
                             kDwgHardPointerId   = 10,
                             kDwgSoftPointerId   = 11,
                             kDwg3Real           = 12,
                             kDwgInt64           = 13,
                             kDwgNotRecognized   = 19 };

 

 

As for the reason, I was trying to find what type a dynamic property  is when we are iterating it, using PropertyTypeCode (a visibility state, distance, etc).

 

Thanks again,

 

Gaston Nunez

 

 

Message 4 of 7
Balaji_Ram
in reply to: hgasty1001

Hi,

 

Glad to know you got that info from Alexander.

 

You dont require a reason to ask 🙂 I asked for it to satisfy my curiosity and to pass it on to my colleagues if I need to ask them.

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 7
khoa.ho
in reply to: Balaji_Ram

I made a quick test with a sample drawing (see attachment) that has a dynamic block with all parameters. The result is shown as below:

PropertyNamePropertyTypeCode
Position X40
Position Y40
Distance40
Origin11
Distance140
Angle40
Origin11
X Distance40
Y Distance40
Origin11
Angle140
Origin11
Flip state70
Visibility1
Lookup1


From that table, PropertyTypeCode is useless to identify a parameter type, as it is not unique. So we have to use PropertyName to specify a parameter type. It is better the API to have a new enum (let's call PropertyType), so "Position X" will associate with an enum PropertyType.PositionX, and so on. Using PropertyName to find the type of a parameter is not strongly-typed and hard-coded.

Please see the sample code to write all dynamic block parameters to the AutoCAD editor:

[CommandMethod("GetAllDynamicBlockParameters")]
public void GetAllDynamicBlockParameters()
{
	Document doc = Application.DocumentManager.MdiActiveDocument;
	Database db = doc.Database;
	Editor editor = doc.Editor;
	var option = new PromptEntityOptions("\n" + "Select a block");
	PromptEntityResult result = editor.GetEntity(option);
	if (result.Status == PromptStatus.OK)
	{
		ObjectId id = result.ObjectId;
		using (Transaction trans = db.TransactionManager.StartTransaction())
		{
			var blockRef = (BlockReference)trans.GetObject(id, OpenMode.ForRead);
			DynamicBlockReferencePropertyCollection properties = blockRef.DynamicBlockReferencePropertyCollection;
			for (int i = 0; i < properties.Count; i++)
			{
				DynamicBlockReferenceProperty property = properties[i];
				editor.WriteMessage("\n" + property.PropertyName + " | " + property.PropertyTypeCode + " | " + property.Value);
			}
		}
	}
}

 

-Khoa

Message 6 of 7
matt.worland
in reply to: khoa.ho

Im testing some blocks in 2023, and the Visibility State seems to be enum 5. Did these change at some point?

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 7 of 7
matt.worland
in reply to: matt.worland

Here are the results I'm getting using AutoCAD 2023 with the file and code from above:

PropertyNamePropertyTypeCode
Position X 1
Position Y 1
Distance 1
Origin 12
Distance1 1
Angle 1
Origin 12
X Distance 1
Y Distance 1
Origin 12
Angle1 1
Origin 12
Flip state 3
Visibility 5
Lookup 5
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost