- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 csharp 于 2015-7-30 21:39 编辑
2012 以上有了 getpropertyvalue 、setpropertyvalue 、dumpallproperties 三个Alisp函数,2013后 ObjectARX 增加了 AcRxValue,类似 C# 的反射方法,在 MAC 上是替代 COM 的方法,下面的代码就是实现 dumpallproperties
- static void asdkMyGroupMyCommand () {
- // Put your command code here
- ads_name e1;
- ads_point pt;
- Acad::ErrorStatus es;
- AcDbObjectId id;
- if (acedEntSel(_T("\nPick Entity: "),e1,pt) != RTNORM)
- {
- return;
- }
- es=acdbGetObjectId(id,e1);
- if (es!=Acad::eOk)
- {
- return;
- }
- //TCHAR tmpResult[256];
- //acedGetString(0,_T("\nProperty Name: "),tmpResult);
- AcDbEntityPointer ent(id,AcDb::kForRead);
- AcRxMemberIterator *iter = AcRxMemberQueryEngine::theEngine()->newMemberIterator(ent);
- AcRxProperty *prop;
- acutPrintf(ACRX_T("\n%-30s\t%-35s\t%s"),_T("PropertyName"),_T("ValueTypeName"),_T("Values"));
- for (;!iter->done();iter->next())
- {
- //AcRxProperty * prop = AcRxProperty::cast(iter->find(tmpResult));
- prop=AcRxProperty::cast(iter->current());
- if (prop != NULL)
- {
- Acad::ErrorStatus err=Acad::eOk;
- AcRxValue value;
- if ((err = prop->getValue(ent,value))==Acad::eOk)
- {
- ACHAR * szValue = NULL;
- int buffSize = value.toString(NULL, 0);
- if (buffSize > 0)
- {
- buffSize++;
- szValue = new ACHAR[buffSize];
- value.toString(szValue, buffSize);
- }
- acutPrintf (
- ACRX_T("\n%-30s\t%-35s\t%s"),
- prop->name(),value.type().name(),
- (szValue == NULL) ? _T("none") : szValue
- );
- if (szValue)
- delete szValue;
- }
- }
- }
- }
复制代码 命令: MYCOMMANDLOCAL
Pick Entity:
PropertyName ValueTypeName Values
Angle double 0.280217
Area double 0.000000
BlockId AcDbObjectId 7ef01cf8
CastShadows bool 0
ClassName AcString none
CollisionType AcDb::CollisionType 1
Color AcCmColor BYLAYER
Delta AcGeVector3d 877.379927 252.500441 0.000000
EndParam double 912.990694
EndPoint AcGePoint3d 2564.850002 1668.429557 0.000000
ExtensionDictionary AcDbObjectId 0
Handle AcDbHandle 249
HasFields bool 0
HasSaveVersionOverride bool 0
IsA AcRxClass* AcDbLine
IsAProxy bool 0
IsCancelling bool 0
IsEraseStatusToggled bool 0
IsErased bool 0
IsModified bool 0
IsModifiedGraphics bool 0
IsModifiedXData bool 0
IsNewObject bool 0
IsNotifyEnabled bool 0
IsNotifying bool 0
IsObjectIdsInFlux bool 0
IsPeriodic bool 0
IsPersistent bool 1
IsPlanar bool 1
IsReadEnabled bool 1
IsReallyClosing bool 1
IsTransactionResident bool 0
IsUndoing bool 0
IsWriteEnabled bool 0
LayerId AcDbObjectId 7ef01c80
Length double 912.990694
LineWeight AcDb::LineWeight -1
LinetypeId AcDbObjectId 7ef01ca8
LinetypeScale double 1.000000
LocalizedName AcString 直线
MaterialId AcDbObjectId 7ef01f60
MergeStyle AcDb::DuplicateRecordCloning 1
Normal AcGeVector3d 0.000000 0.000000 1.000000
ObjectId AcDbObjectId 7ef03688
OwnerId AcDbObjectId 7ef01cf8
PlotStyleName AcString ByLayer
ReceiveShadows bool 0
StartParam double 0.000000
StartPoint AcGePoint3d 1687.470075 1415.929116 0.000000
Thickness double 0.000000
Transparency AcCmTransparency 0
Visible AcDb::Visibility 0
命令: (dumppropertries (entlast))
; 错误: no function definition: DUMPPROPERTRIES
命令: (dumpallproperties (entlast))
Begin dumping object (class: AcDbLine)
Angle (type: double) (RO) (LocalName: 角度) = 0.280217
Annotative (type: bool) (LocalName: 注释性) = Failed to get value
AnnotativeScale (type: AcString) (RO) (LocalName: 注释性比例) = Failed to get value
Area (type: double) (RO) (LocalName: 面积) = 0.000000
BlockId (type: AcDbObjectId) (RO) = 7ef01cf8
CastShadows (type: bool) = 0
ClassName (type: AcString) (RO) =
Closed (type: bool) (RO) (LocalName: 闭合) = Failed to get value
CollisionType (type: AcDb::CollisionType) (RO) = 1
Color (type: AcCmColor) (LocalName: 颜色) = BYLAYER
Delta/X (type: double) (RO) (LocalName: 增量 X) = 877.379927
Delta/Y (type: double) (RO) (LocalName: 增量 Y) = 252.500441
Delta/Z (type: double) (RO) (LocalName: 增量 Z) = 0.000000
EndParam (type: double) (RO) = 912.990694
EndPoint/X (type: double) (LocalName: 端点 X 坐标) = 2564.850002
EndPoint/Y (type: double) (LocalName: 端点 Y 坐标) = 1668.429557
EndPoint/Z (type: double) (LocalName: 端点 Z 坐标) = 0.000000
ExtensionDictionary (type: AcDbObjectId) (RO) = 0
Handle (type: AcDbHandle) (RO) = 249
HasFields (type: bool) (RO) = 0
HasSaveVersionOverride (type: bool) = 0
Hyperlinks (type: AcDbHyperlink*)
IsA (type: AcRxClass*) (RO) = AcDbLine
IsAProxy (type: bool) (RO) = 0
IsCancelling (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
IsPeriodic (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
LayerId (type: AcDbObjectId) (LocalName: 图层) = 7ef01c80
Length (type: double) (RO) (LocalName: 长度) = 912.990694
LineWeight (type: AcDb::LineWeight) (LocalName: 线宽) = -1
LinetypeId (type: AcDbObjectId) (LocalName: 线型) = 7ef01ca8
LinetypeScale (type: double) (LocalName: 线型比例) = 1.000000
LocalizedName (type: AcString) (RO) = 直线
MaterialId (type: AcDbObjectId) (LocalName: 材质) = 7ef01f60
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) = 7ef03688
OwnerId (type: AcDbObjectId) (RO) = 7ef01cf8
PlotStyleName (type: AcString) (LocalName: 打印样式) = ByLayer
ReceiveShadows (type: bool) = 0
ShadowDisplay (type: AcDb::ShadowFlags) (RO) (LocalName: 阴影显示) = Failed to get value
StartParam (type: double) (RO) = 0.000000
StartPoint/X (type: double) (LocalName: 起点 X 坐标) = 1687.470075
StartPoint/Y (type: double) (LocalName: 起点 Y 坐标) = 1415.929116
StartPoint/Z (type: double) (LocalName: 起点 Z 坐标) = 0.000000
Thickness (type: double) (LocalName: 厚度) = 0.000000
Transparency (type: AcCmTransparency) (LocalName: 透明度) = 0
Visible (type: AcDb::Visibility) = 0
End object dump
nil
|
|