赞
踩
每一个CAD文件(DWG或者是DXF)都对应了一个数据库(Database),数据库中保存了CAD的所有对象。包括但不限于点、线、文字、块,图层、线型、线宽、颜色、标注等。
CAD二次开发的本质就是通过对数据库(Database)的操作。通过往数据库(Database)中写入数据,从而实现图形的绘制。通过获取数据库(Database)中保存的数据,对其中的数据进行修改,从而实现对图形的修改。
CAD二次开发中对象选择的本质,就是选择数据库(Database)外在的表象(点、线、文字、块,图层、标注、字典等),从而获得其保存在数据库(Database)的ObjectId,从而达到对CAD对象操作的目的。
实体类(Entity)对象,其命名空间为Autodesk.AutoCAD.DatabaseServices,属于数据库(Database)对象,其派生类包括CAD绘图区域里能看到的所有对象(布局Layout不属于实体类,但布局里的视口属于实体类。)
基本信息 | 基本信息内容 |
---|---|
类名称: | Entity |
类全称: | Autodesk.AutoCAD.DatabaseServices.Entity |
命名空间: | Autodesk.AutoCAD.DatabaseServices |
所属文件: | C:\Program Files\Autodesk\AutoCAD 2019\AcdbMgd.dll |
基类: | Autodesk.AutoCAD.DatabaseServices.DBObject |
派生类: | ImpEntity |
派生类: | BlockReference |
派生类: | Table |
派生类: | DBText |
派生类: | Viewport |
派生类: | Curve |
派生类: | ImpCurve |
派生类: | Ray |
派生类: | Line |
派生类: | Circle |
派生类: | Dimension |
派生类: | ImpDimension |
派生类: | RadialDimension |
派生类: | OrdinateDimension |
派生类: | RotatedDimension |
派生类: | Point3AngularDimension |
派生类: | Polyline3d |
派生类: | LineAngularDimension2 |
派生类: | Polyline2d |
派生类: | Vertex |
派生类: | Vertex2d |
派生类: | PolylineVertex3d |
派生类: | Surface |
派生类: | Solid3d |
派生类: | AlignedDimension |
派生类: | Arc |
派生类: | AttributeReference |
派生类: | AttributeDefinition |
派生类: | BlockBegin |
派生类: | BlockEnd |
派生类: | MInsertBlock |
派生类: | Body |
派生类: | DiametricDimension |
派生类: | Ellipse |
派生类: | Face |
派生类: | FaceRecord |
派生类: | FeatureControlFrame |
派生类: | Ole2Frame |
派生类: | Hatch |
派生类: | Image |
派生类: | RasterImage |
派生类: | DBPoint |
派生类: | PolyFaceMesh |
派生类: | PolyFaceMeshVertex |
派生类: | PolygonMesh |
派生类: | PolygonMeshVertex |
派生类: | Leader |
派生类: | MText |
派生类: | Mline |
派生类: | Polyline |
派生类: | ProxyEntity |
派生类: | Region |
派生类: | SequenceEnd |
派生类: | Shape |
派生类: | Solid |
派生类: | Trace |
派生类: | Xline |
派生类: | Spline |
派生类: | RadialDimensionLarge |
派生类: | ArcDimension |
派生类: | Section |
派生类: | UnderlayReference |
派生类: | DwfReference |
派生类: | DgnReference |
派生类: | PdfReference |
派生类: | Helix |
派生类: | Light |
派生类: | LoftedSurface |
派生类: | SweptSurface |
派生类: | RevolvedSurface |
派生类: | PlaneSurface |
派生类: | ExtrudedSurface |
派生类: | Wipeout |
派生类: | MLeader |
派生类: | SubDMesh |
派生类: | NurbSurface |
派生类: | PointCloud |
派生类: | PointCloudEx |
派生类: | ViewBorder |
派生类: | ViewRepBlockReference |
派生类: | DetailSymbol |
派生类: | SectionSymbol |
派生类: | GeomapImage |
派生类: | GeoPositionMarker |
方法名称 | 返回类型 | 是否公共函数 | 是否静态函数 |
---|---|---|---|
AddContext(ObjectContext context) | Void | True | False |
AddSubentityPaths(FullSubentityPath[] subPaths) | Void | True | False |
ApplyPaperOrientationTransform(Viewport viewport) | Void | True | False |
ApplyPartialUndo(DwgFiler undoFiler,RXClass classObj) | Void | True | False |
Audit(AuditInfo auditInfo) | Void | True | False |
BoundingBoxIntersectWith(Entity entityPointer,Intersect intersectType,Point3dCollection points,IntPtr thisGraphicSystemMarker,IntPtr otherGraphicSystemMarker) | Void | True | False |
BoundingBoxIntersectWith(Entity entityPointer,Intersect intersectType,Plane projectionPlane,Point3dCollection points,IntPtr thisGraphicSystemMarker,IntPtr otherGraphicSystemMarker) | Void | True | False |
BoundingBoxIntersectWith(Entity entityPointer,Intersect intersectType,Point3dCollection points,Int64 thisGraphicSystemMarker,Int64 otherGraphicSystemMarker) | Void | True | False |
BoundingBoxIntersectWith(Entity entityPointer,Intersect intersectType,Plane projectionPlane,Point3dCollection points,Int64 thisGraphicSystemMarker,Int64 otherGraphicSystemMarker) | Void | True | False |
Cancel() | Void | True | False |
Clone() | Object | True | False |
Close() | Void | True | False |
CloseAndPage(Boolean onlyWhenClean) | Void | True | False |
CompareTo(Object obj) | Int32 | True | False |
CopyFrom(RXObject source) | Void | True | False |
CreateExtensionDictionary() | Void | True | False |
CreateObjRef(Type requestedType) | ObjRef | True | False |
DecomposeForSave(DwgVersion version) | DecomposeForSaveReplacementRecord | True | False |
DeepClone(DBObject ownerPointer,IdMapping idMap,Boolean isPrimary) | DBObject | True | False |
DeleteSubentityPaths(FullSubentityPath[] subPaths) | Void | True | False |
DisableUndoRecording(Boolean disable) | Void | True | False |
Dispose() | Void | True | False |
DowngradeOpen() | Void | True | False |
DowngradeToNotify(Boolean wasWritable) | Void | True | False |
Draw() | Void | True | False |
DwgIn(DwgFiler filer) | Void | True | False |
DwgOut(DwgFiler filer) | Void | True | False |
DxfIn(DxfFiler filer) | Void | True | False |
DxfOut(DxfFiler filer) | Void | True | False |
Equals(Object obj) | Boolean | True | False |
Erase() | Void | True | False |
Erase(Boolean erasing) | Void | True | False |
Explode(DBObjectCollection entitySet) | Void | True | False |
GetEventExtender(Boolean create) | DBObjectEventExtender | True | False |
GetField(String propertyName) | ObjectId | True | False |
GetField() | ObjectId | True | False |
GetGraphicsMarkersAtSubentityPathIntPtr(FullSubentityPath subPath) | IntPtrCollection | True | False |
GetGripPoints(GripDataCollection grips,Double curViewUnitSize,Int32 gripSize,Vector3d curViewDir,GetGripPointsFlags bitFlags) | Boolean | True | False |
GetGripPoints(Point3dCollection gripPoints,IntegerCollection snapModes,IntegerCollection geometryIds) | Void | True | False |
GetGripPointsAtSubentityPath(FullSubentityPath subPath,GripDataCollection grips,Double curViewUnitSize,Int32 gripSize,Vector3d curViewDir,GetGripPointsFlags bitFlags) | Boolean | True | False |
GetHashCode() | Int32 | True | False |
GetLifetimeService() | Object | True | False |
GetObjectSaveVersion(DxfFiler filer) | FullDwgVersion | True | False |
GetObjectSaveVersion(DwgFiler filer) | FullDwgVersion | True | False |
GetObjectSnapPoints(ObjectSnapModes snapMode,Int32 gsSelectionMark,Point3d pickPoint,Point3d lastPoint,Matrix3d viewTransform,Point3dCollection snapPoints,IntegerCollection geometryIds,Matrix3d insertionMat) | Void | True | False |
GetObjectSnapPoints(ObjectSnapModes snapMode,Int32 gsSelectionMark,Point3d pickPoint,Point3d lastPoint,Matrix3d viewTransform,Point3dCollection snapPoints,IntegerCollection geometryIds) | Void | True | False |
GetParameterInterface(String name,Boolean runtimeInterface) | IParameter | True | False |
GetPersistentReactorIds() | ObjectIdCollection | True | False |
GetPlane() | Plane | True | False |
GetReactors() | List`1 | True | False |
GetRXClass() | RXClass | True | False |
GetStretchPoints(Point3dCollection stretchPoints) | Void | True | False |
GetSubentity(FullSubentityPath id) | Entity | True | False |
GetSubentityGeometricExtents(FullSubentityPath subPath) | Extents3d | True | False |
GetSubentityPathsAtGraphicsMarker(SubentityType type,IntPtr gsMark,Point3d pickPoint,Matrix3d viewTransform,ObjectId[] entityAndInsertStack) | FullSubentityPath[] | True | False |
GetSubentityPathsAtGraphicsMarker(SubentityType type,Int64 gsMark,Point3d pickPoint,Matrix3d viewTransform,Int32 numInserts,ObjectId[] entityAndInsertStack) | FullSubentityPath[] | True | False |
GetTransformedCopy(Matrix3d transform) | Entity | True | False |
GetTransientReactors() | List`1 | True | False |
GetType() | Type | True | False |
GetXDataForApplication(String applicationName) | ResultBuffer | True | False |
HandOverTo(DBObject newPointer,Boolean keepXData,Boolean keepExtensionDictionary) | Void | True | False |
HasContext(ObjectContext context) | Boolean | True | False |
HasPersistentReactor(ObjectId objId) | Boolean | True | False |
Highlight(FullSubentityPath subId,Boolean highlightAll) | Void | True | False |
Highlight() | Void | True | False |
HighlightState(FullSubentityPath subId) | HighlightStyle | True | False |
InitializeLifetimeService() | Object | True | False |
IntersectWith(Entity entityPointer,Intersect intersectType,Plane projectionPlane,Point3dCollection points,IntPtr thisGraphicSystemMarker,IntPtr otherGraphicSystemMarker) | Void | True | False |
IntersectWith(Entity entityPointer,Intersect intersectType,Point3dCollection points,IntPtr thisGraphicSystemMarker,IntPtr otherGraphicSystemMarker) | Void | True | False |
IntersectWith(Entity entityPointer,Intersect intersectType,Plane projectionPlane,Point3dCollection points,Int64 thisGraphicSystemMarker,Int64 otherGraphicSystemMarker) | Void | True | False |
IntersectWith(Entity entityPointer,Intersect intersectType,Point3dCollection points,Int64 thisGraphicSystemMarker,Int64 otherGraphicSystemMarker) | Void | True | False |
IsContentSnappable() | Boolean | True | False |
JoinEntities(Entity[] otherEntities) | IntegerCollection | True | False |
JoinEntity(Entity secondaryEntity) | Void | True | False |
List() | Void | True | False |
MoveGripPointsAt(GripDataCollection grips,Vector3d offset,MoveGripPointsFlags bitFlags) | Void | True | False |
MoveGripPointsAt(IntegerCollection indices,Vector3d offset) | Void | True | False |
MoveGripPointsAtSubentityPaths(FullSubentityPath[] subPaths,IntPtr[] appData,Vector3d offset,MoveGripPointsFlags bitFlags) | Void | True | False |
MoveStretchPointsAt(IntegerCollection indices,Vector3d offset) | Void | True | False |
PopHighlight(FullSubentityPath subId) | Void | True | False |
PushHighlight(FullSubentityPath subId,HighlightStyle highlightStyle) | Void | True | False |
QueryX(RXClass protocolClass) | IntPtr | True | False |
RecordGraphicsModified(Boolean setModified) | Void | True | False |
ReleaseExtensionDictionary() | Void | True | False |
RemoveContext(ObjectContext context) | Void | True | False |
RemoveField(ObjectId id) | Void | True | False |
RemoveField(String propertyName) | ObjectId | True | False |
RemoveField() | ObjectId | True | False |
ResetScaleDependentProperties() | Void | True | False |
SaveAs(WorldDraw mode,SaveType st) | Void | True | False |
SetAttributes(DrawableTraits traits) | Int32 | True | False |
SetDatabaseDefaults(Database sourceDatabase) | Void | True | False |
SetDatabaseDefaults() | Void | True | False |
SetDragStatus(DragStatus status) | Void | True | False |
SetField(String propertyName,Field field) | ObjectId | True | False |
SetField(Field field) | ObjectId | True | False |
SetFromStyle() | Boolean | True | False |
SetGripStatus(GripStatus status) | Void | True | False |
SetLayerId(ObjectId newValue,Boolean allowHidden) | Void | True | False |
SetObjectIdsInFlux() | Void | True | False |
SetPaperOrientation(Boolean bPaperOrientation) | Void | True | False |
SetPropertiesFrom(Entity entityPointer) | Void | True | False |
SetSubentityGripStatus(GripStatus status,FullSubentityPath subentity) | Void | True | False |
SupportsCollection(String collectionName) | Boolean | True | False |
SwapIdWith(ObjectId otherId,Boolean swapExtendedData,Boolean swapExtensionDictionary) | Void | True | False |
SwapReferences(IdMapping idMap) | Void | True | False |
ToString() | String | True | False |
TransformBy(Matrix3d transform) | Void | True | False |
TransformSubentityPathsBy(FullSubentityPath[] subPaths,Matrix3d transform) | Void | True | False |
Unhighlight(FullSubentityPath subId,Boolean highlightAll) | Void | True | False |
Unhighlight() | Void | True | False |
UpgradeFromNotify() | Boolean | True | False |
UpgradeOpen() | Void | True | False |
ViewportDraw(ViewportDraw vd) | Void | True | False |
ViewportDrawLogicalFlags(ViewportDraw vd) | Int32 | True | False |
WblockClone(RXObject ownerPointer,IdMapping idMap,Boolean isPrimary) | DBObject | True | False |
WorldDraw(WorldDraw wd) | Boolean | True | False |
X(RXClass protocolClass) | IntPtr | True | False |
XDataTransformBy(Matrix3d transform) | Void | True | False |
属性名称 | 属性类型 | 是否可写 |
---|---|---|
AcadObject | System.Object | False |
Annotative | Autodesk.AutoCAD.DatabaseServices.AnnotativeStates | True |
AutoDelete | System.Boolean | True |
BlockId | Autodesk.AutoCAD.DatabaseServices.ObjectId | False |
BlockName | System.String | False |
Bounds | System.Nullable`1[Autodesk.AutoCAD.DatabaseServices.Extents3d] | False |
CastShadows | System.Boolean | True |
ClassID | System.Guid | False |
CloneMeForDragging | System.Boolean | False |
CollisionType | Autodesk.AutoCAD.DatabaseServices.CollisionType | False |
Color | Autodesk.AutoCAD.Colors.Color | True |
ColorIndex | System.Int32 | True |
CompoundObjectTransform | Autodesk.AutoCAD.Geometry.Matrix3d | False |
Database | Autodesk.AutoCAD.DatabaseServices.Database | False |
Drawable | Autodesk.AutoCAD.GraphicsInterface.Drawable | False |
DrawableType | Autodesk.AutoCAD.GraphicsInterface.DrawableType | False |
DrawStream | Autodesk.AutoCAD.GraphicsInterface.DrawStream | True |
Ecs | Autodesk.AutoCAD.Geometry.Matrix3d | False |
EdgeStyleId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
EntityColor | Autodesk.AutoCAD.Colors.EntityColor | False |
ExtensionDictionary | Autodesk.AutoCAD.DatabaseServices.ObjectId | False |
FaceStyleId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
ForceAnnoAllVisible | System.Boolean | True |
GeometricExtents | Autodesk.AutoCAD.DatabaseServices.Extents3d | False |
Handle | Autodesk.AutoCAD.DatabaseServices.Handle | False |
HasFields | System.Boolean | False |
HasSaveVersionOverride | System.Boolean | True |
Hyperlinks | Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection | False |
Id | Autodesk.AutoCAD.DatabaseServices.ObjectId | False |
IsAProxy | System.Boolean | False |
IsCancelling | System.Boolean | False |
IsDisposed | System.Boolean | False |
IsErased | System.Boolean | False |
IsEraseStatusToggled | System.Boolean | False |
IsModified | System.Boolean | False |
IsModifiedGraphics | System.Boolean | False |
IsModifiedXData | System.Boolean | False |
IsNewObject | System.Boolean | False |
IsNotifyEnabled | System.Boolean | False |
IsNotifying | System.Boolean | False |
IsObjectIdsInFlux | System.Boolean | False |
IsPersistent | System.Boolean | False |
IsPlanar | System.Boolean | False |
IsReadEnabled | System.Boolean | False |
IsReallyClosing | System.Boolean | False |
IsTransactionResident | System.Boolean | False |
IsUndoing | System.Boolean | False |
IsWriteEnabled | System.Boolean | False |
Layer | System.String | True |
LayerId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
Linetype | System.String | True |
LinetypeId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
LinetypeScale | System.Double | True |
LineWeight | Autodesk.AutoCAD.DatabaseServices.LineWeight | True |
Material | System.String | True |
MaterialId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
MaterialMapper | Autodesk.AutoCAD.GraphicsInterface.Mapper | True |
MergeStyle | Autodesk.AutoCAD.DatabaseServices.DuplicateRecordCloning | True |
ObjectBirthVersion | Autodesk.AutoCAD.DatabaseServices.FullDwgVersion | False |
ObjectId | Autodesk.AutoCAD.DatabaseServices.ObjectId | False |
OwnerId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
PaperOrientation | Autodesk.AutoCAD.DatabaseServices.PaperOrientationStates | False |
PlotStyleName | System.String | True |
PlotStyleNameId | Autodesk.AutoCAD.DatabaseServices.PlotStyleDescriptor | True |
ReceiveShadows | System.Boolean | True |
Transparency | Autodesk.AutoCAD.Colors.Transparency | True |
UndoFiler | Autodesk.AutoCAD.DatabaseServices.DwgFiler | False |
UnmanagedObject | System.IntPtr | False |
Visible | System.Boolean | True |
VisualStyleId | Autodesk.AutoCAD.DatabaseServices.ObjectId | True |
XData | Autodesk.AutoCAD.DatabaseServices.ResultBuffer | True |
通过GetEntity()函数,可以在绘图区域内选择单个实体类对象,其返回值为单个ObjectId 。该对象选择方法在实际中不是很实用,仅在此做简单介绍。
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptEntityResult result1 = ed.GetEntity("请选择对象");
if (result1.Status != PromptStatus.OK) return;//如果选择对象不为空
ObjectId objectId = result1.ObjectId;//获得实体类对象的ObjectId
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。