找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 3969|回复: 1

[每日一码] MemberInfo查询DBObject的属性和方法

[复制链接]

已领礼包: 859个

财富等级: 财运亨通

发表于 2015-1-10 08:24:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×


  1. using System.Reflection;
  2. using Autodesk.AutoCAD.Runtime;
  3. using Autodesk.AutoCAD.ApplicationServices;
  4. using Autodesk.AutoCAD.DatabaseServices;
  5. using Autodesk.AutoCAD.EditorInput;
  6. using Exception = System.Exception;

  7. [assembly: CommandClass(typeof(AutoCAD_CSharp_plug_in35.MyCommands))]

  8. namespace AutoCAD_CSharp_plug_in35
  9. {
  10.     public class MyCommands
  11.     {
  12.         [LispFunction("test", "MyLispFunctionLocal")]
  13.         public void MyLispFunction(ResultBuffer args) // This method can have any name
  14.         {
  15.             if (args != null)
  16.             {
  17.                 TypedValue[] values = args.AsArray();
  18.                 if (values .Length == 1 && values[0].TypeCode == (int)LispDataType .ObjectId )
  19.                 {
  20.                     Document doc = Application.DocumentManager.MdiActiveDocument;
  21.                     Editor ed = doc.Editor;
  22.                     Database db = doc.Database;
  23.                     Transaction tr = db.TransactionManager.StartTransaction();
  24.                     using (tr)
  25.                     {
  26.                         try
  27.                         {
  28.                             var id =(ObjectId ) values[0].Value;
  29.                             var obj = (DBObject) id.GetObject(OpenMode.ForRead);
  30.                             foreach (MemberInfo objMemberInfo in obj.GetType().GetMembers())
  31.                             {
  32.                                 ed.WriteMessage("\n" + objMemberInfo.Name.ToString());
  33.                             }
  34.                             tr.Commit();
  35.                         }
  36.                         catch (Exception)
  37.                         {
  38.                             throw;
  39.                         }
  40.                     }
  41.                 }
  42.             }
  43.         }
  44.     }
  45. }
命令: NETLOAD
命令: (test (entlast))

get_StartPoint
set_StartPoint
get_EndPoint
set_EndPoint
get_Thickness
set_Thickness
get_Normal
set_Normal
get_Delta
get_Angle
get_Length
get_Closed
get_IsPeriodic
get_StartParam
get_EndParam
GetPointAtParameter
GetParameterAtPoint
GetDistanceAtParameter
GetParameterAtDistance
GetDistAtPoint
GetPointAtDist
GetFirstDerivative
GetFirstDerivative
GetSecondDerivative
GetSecondDerivative
GetClosestPointTo
GetClosestPointTo
GetOrthoProjectedCurve
GetProjectedCurve
GetOffsetCurves
GetOffsetCurvesGivenPlaneNormal
get_Spline
GetSplitCurves
GetSplitCurves
Extend
Extend
get_Area
ReverseCurve
GetGeCurve
GetGeCurve
SetFromGeCurve
SetFromGeCurve
SetFromGeCurve
SetFromGeCurve
set_MaterialMapper
get_BlockName
get_ForceAnnoAllVisible
set_ForceAnnoAllVisible
get_VisualStyleId
set_VisualStyleId
get_FaceStyleId
set_FaceStyleId
get_EdgeStyleId
set_EdgeStyleId
JoinEntity
JoinEntities
get_BlockId
get_Color
set_Color
get_ColorIndex
set_ColorIndex
get_EntityColor
get_Transparency
set_Transparency
get_PlotStyleName
set_PlotStyleName
get_PlotStyleNameId
set_PlotStyleNameId
get_Layer
set_Layer
get_LayerId
set_LayerId
SetLayerId
get_Linetype
set_Linetype
get_LinetypeId
set_LinetypeId
get_LinetypeScale
set_LinetypeScale
get_Visible
set_Visible
get_LineWeight
set_LineWeight
get_CollisionType
SetPropertiesFrom
get_IsPlanar
GetPlane
get_Ecs
get_GeometricExtents
AddSubentityPaths
DeleteSubentityPaths
TransformSubentityPathsBy
GetGripPointsAtSubentityPath
MoveGripPointsAtSubentityPaths
GetSubentityGeometricExtents
GetSubentityPathsAtGraphicsMarker
GetSubentityPathsAtGraphicsMarker
GetGraphicsMarkersAtSubentityPathIntPtr
Highlight
Highlight
Unhighlight
Unhighlight
PushHighlight
PopHighlight
HighlightState
GetObjectSnapPoints
GetObjectSnapPoints
IsContentSnappable
GetGripPoints
GetGripPoints
MoveGripPointsAt
MoveGripPointsAt
GetStretchPoints
MoveStretchPointsAt
IntersectWith
IntersectWith
IntersectWith
IntersectWith
BoundingBoxIntersectWith
BoundingBoxIntersectWith
BoundingBoxIntersectWith
BoundingBoxIntersectWith
List
TransformBy
GetTransformedCopy
GetSubentity
Explode
RecordGraphicsModified
Draw
SaveAs
get_CompoundObjectTransform
SetDatabaseDefaults
SetDatabaseDefaults
get_CloneMeForDragging
SetDragStatus
SetGripStatus
SetSubentityGripStatus
get_Hyperlinks
get_CastShadows
set_CastShadows
get_ReceiveShadows
set_ReceiveShadows
get_Material
set_Material
get_MaterialId
set_MaterialId
get_MaterialMapper
SetPaperOrientation
ApplyPaperOrientationTransform
SupportsCollection
HasContext
AddContext
RemoveContext
GetEventExtender
add_Cancelled
remove_Cancelled
add_Copied
remove_Copied
add_Erased
remove_Erased
add_Goodbye
remove_Goodbye
add_OpenedForModify
remove_OpenedForModify
add_Modified
remove_Modified
add_SubObjectModified
remove_SubObjectModified
add_ModifyUndone
remove_ModifyUndone
add_ModifiedXData
remove_ModifiedXData
add_Unappended
remove_Unappended
add_Reappended
remove_Reappended
add_ObjectClosed
remove_ObjectClosed
GetParameterInterface
get_IsPersistent
get_Id
get_ObjectId
get_OwnerId
set_OwnerId
get_Handle
get_Database
DeepClone
WblockClone
DecomposeForSave
get_Drawable
CreateExtensionDictionary
get_ExtensionDictionary
ReleaseExtensionDictionary
UpgradeOpen
UpgradeFromNotify
DowngradeOpen
DowngradeToNotify
Cancel
Close
CloseAndPage
Erase
Erase
HandOverTo
SwapIdWith
SwapReferences
Audit
DwgIn
DwgOut
DxfIn
DxfOut
get_MergeStyle
set_MergeStyle
get_XData
set_XData
XDataTransformBy
GetXDataForApplication
get_IsEraseStatusToggled
get_IsErased
get_IsReadEnabled
get_IsWriteEnabled
get_IsNotifyEnabled
get_IsModified
get_IsModifiedXData
get_IsModifiedGraphics
get_IsNewObject
get_IsNotifying
get_IsUndoing
get_IsCancelling
get_IsReallyClosing
get_IsTransactionResident
get_IsAProxy
DisableUndoRecording
get_UndoFiler
ApplyPartialUndo
HasPersistentReactor
GetReactors
GetTransientReactors
GetPersistentReactorIds
SetObjectIdsInFlux
get_IsObjectIdsInFlux
get_HasSaveVersionOverride
set_HasSaveVersionOverride
GetObjectSaveVersion
GetObjectSaveVersion
get_ObjectBirthVersion
get_ClassID
get_AcadObject
GetField
GetField
SetField
SetField
get_HasFields
RemoveField
RemoveField
RemoveField
get_Annotative
set_Annotative
SetFromStyle
ResetScaleDependentProperties
get_PaperOrientation
SetAttributes
WorldDraw
ViewportDraw
ViewportDrawLogicalFlags
get_DrawableType
get_Bounds
get_DrawStream
set_DrawStream
X
QueryX
GetRXClass
CompareTo
Clone
CopyFrom
get_UnmanagedObject
get_IsDisposed
get_AutoDelete
Equals
GetHashCode
Dispose
GetLifetimeService
InitializeLifetimeService
CreateObjRef
ToString
GetType
.ctor
.ctor
Length
Angle
Delta
Normal
Thickness
EndPoint
StartPoint
Area
Spline
EndParam
StartParam
IsPeriodic
Closed
EdgeStyleId
FaceStyleId
VisualStyleId
ForceAnnoAllVisible
BlockName
MaterialMapper
MaterialId
Material
ReceiveShadows
CastShadows
Hyperlinks
CloneMeForDragging
CompoundObjectTransform
GeometricExtents
Ecs
IsPlanar
CollisionType
LineWeight
Visible
LinetypeScale
LinetypeId
Linetype
LayerId
Layer
PlotStyleNameId
PlotStyleName
Transparency
EntityColor
ColorIndex
Color
BlockId
PaperOrientation
Annotative
HasFields
AcadObject
ClassID
ObjectBirthVersion
HasSaveVersionOverride
IsObjectIdsInFlux
UndoFiler
IsAProxy
IsTransactionResident
IsReallyClosing
IsCancelling
IsUndoing
IsNotifying
IsNewObject
IsModifiedGraphics
IsModifiedXData
IsModified
IsNotifyEnabled
IsWriteEnabled
IsReadEnabled
IsErased
IsEraseStatusToggled
XData
MergeStyle
ExtensionDictionary
Drawable
Database
Handle
OwnerId
ObjectId
Id
IsPersistent
DrawStream
Bounds
DrawableType
AutoDelete
IsDisposed
UnmanagedObject
ObjectClosed
Reappended
Unappended
ModifiedXData
ModifyUndone
SubObjectModified
Modified
OpenedForModify
Goodbye
Erased
Copied
Cancelled
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 859个

财富等级: 财运亨通

 楼主| 发表于 2015-1-10 09:56:34 来自手机 | 显示全部楼层
本帖最后由 csharp 于 2015-1-10 09:58 编辑

留存
http://www.it165.net/pro/html/201209/3724.html

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-12-18 22:43 , Processed in 0.312714 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表