C# Solidworks二次开发:枚举在solidworks中的使用详解

发布于:2024-04-24 ⋅ 阅读:(37) ⋅ 点赞:(0)

大家好,今天要介绍的是一些枚举,这些枚举在solidworks中还是非常重要的。

下面直接开始介绍枚举:

(1)第一个要介绍的是swDrawingNotify_e,这个枚举值的含义是工程图操作中的通知,下面是官方的枚举值:

Member Description
swDrawingActivateSheetPostNotify 53 = ActivateSheetPostNotify
swDrawingActivateSheetPreNotify 52 = ActivateSheetPreNotify
swDrawingAddCustomPropertyNotify 20 = AddCustomPropertyNotify
swDrawingAddDvePagePreNotify 40 = Not used.
swDrawingAddItemNotify 15 = AddItemNotify
swDrawingAutoSaveNotify 10 = AutoSaveNotify
swDrawingAutoSaveToStorageNotify 11 = AutoSaveToStorageNotify
swDrawingAutoSaveToStorageStoreNotify 48 = AutoSaveToStorageStoreNotify
swDrawingChangeCustomPropertyNotify 21 = ChangeCustomPropertyNotify
swDrawingClearSelectionsNotify 37 = ClearSelectionsNotify
swDrawingCommandManagerTabActivatedPreNotify 54 = CommandManagerTabActivatedPreNotify
swDrawingConfigChangeNotify 12 = ActiveConfigChangeNotify
swDrawingConfigChangePostNotify 13 = ActiveConfigChangePostNotify
swDrawingDeleteCustomPropertyNotify 22 = DeleteCustomPropertyNotify
swDrawingDeleteItemNotify 17 = DeleteItemNotify
swDrawingDeleteItemPreNotify 36 = DeleteItemPreNotify
swDrawingDeleteSelectionPreNotify 24 = DeleteSelectonPreNotify
swDrawingDestroyNotify 2 = Obsolete
swDrawingDestroyNotify2 42 = DestroyNotify2
swDrawingDimensionChangeNotify 32 = DimensionChangeNotify
swDrawingDynamicHighlightNotify 31 = DynamicHighlightNotify
swDrawingEquationEditorPostNotify 39 = EquationEditorPostNotify
swDrawingEquationEditorPreNotify 38 = EquationEditorPreNotify
swDrawingFeatureManagerTabActivatedNotify 56 = FeatureManagerTabActivatedNotify
swDrawingFeatureManagerTabActivatedPreNotify 55 = FeatureManagerTabActivatedPreNotify
swDrawingFeatureManagerTreeRebuildNotify 29 = FeatureManagerTreeRebuildNotify
swDrawingFileReloadCancelNotify 33 = Not used.
swDrawingFileReloadNotify 19 = Not used.
swDrawingFileReloadPreNotify 25 = Not used.
swDrawingFileSaveAsNotify 7 = Obsolete
swDrawingFileSaveAsNotify2 23 = FileSaveAsNotify2
swDrawingFileSaveNotify 6 = FileSaveNotify
swDrawingFileSavePostCancelNotify 34 = FileSavePostCancelNotify
swDrawingFileSavePostNotify 26 = FileSavePostNotify
swDrawingInsertTableNotify 49 = InsertTableNotify
swDrawingLoadFromStorageNotify 8 = LoadFromStorageNotify
swDrawingLoadFromStorageStoreNotify 27 = LoadFromStorageStoreNotify
swDrawingModifyNotify 18 = ModifyNotify
swDrawingModifyTableNotify 50 = ModifyTableNotify
swDrawingNewSelectionNotify 5 = NewSelectionNotify
swDrawingRedoPostNotify 45 = RedoPostNotify
swDrawingRedoPreNotify 46 = RedoPreNotify
swDrawingRegenNotify 1 = RegenNotify
swDrawingRegenPostNotify 3 = RegenPostNotify
swDrawingRenameDisplayTitleNotify 57 = RenameDisplayTitleNotify
swDrawingRenameItemNotify 16 = RenameItemNotify
swDrawingSaveToStorageNotify 9 = SaveToStorageNotify
swDrawingSaveToStorageStoreNotify 28 = SaveToStorageStoreNotify
swDrawingSketchSolveNotify 35 = SketchSolveNotify
swDrawingUndoPostNotify 43 = UndoPostNotify
swDrawingUndoPreNotify 47 = UndoPreNotify
swDrawingUnitsChangeNotify 41 = UnitsChangeNotify
swDrawingUserSelectionPostNotify 51 = UserSelectionPostNotify
swDrawingUserSelectionPreNotify 44 = UserSelectionPreNotify
swDrawingViewCreatePreNotify 30 = ViewCreatePreNotify
swDrawingViewNewNotify 4 = Obsolete
swDrawingViewNewNotify2 14 = ViewNewNotify2

使用时候有一个注意事项:

要接收通知,DLL应用程序必须按对象类型注册通知。这种注册必须针对特定对象的每个实例进行。

(2)第二个为swFeatureError_e,这个枚举的意思是特征的错误代码,下面是官方的枚举值:

Member Description
swFeatureErrorExtrusionBadGeometricConditions 32 = Unable to create this extruded feature due to geometric conditions
swFeatureErrorExtrusionBossContourInvalid 37 = Bosses require one or more closed contours that do not self-intersect
swFeatureErrorExtrusionBossContourOpenAndClosed 36 = Bosses cannot have both open and closed contours
swFeatureErrorExtrusionCutContourInvalid 34 = Extruded cuts require at least one closed or open contour that does not self-intersect
swFeatureErrorExtrusionCutContourOpenAndClosed 33 = Extruded cuts cannot have both open and closed contours
swFeatureErrorExtrusionDisjoint 30 = Feature would create a disjoint body; direction may be wrong
swFeatureErrorExtrusionNoEndFound 31 = Cannot locate end of feature
swFeatureErrorExtrusionOpenCutContourInvalid 35 = Open extruded cuts require a single open contour that does not self-intersect
swFeatureErrorFeatureDeprecated 49 
swFeatureErrorFeatureObsolete 50 
swFeatureErrorFilletCannotExtend 16 = Selected elements cannot be extended to intersect
swFeatureErrorFilletInvalidRadius 12 = Invalid fillet radius or a face blend fillet recommended
swFeatureErrorFilletModelGeometry 14 = Failed to create fillet due to model geometry
swFeatureErrorFilletNoEdge 13 = Edge for fillet/chamfer does not exist
swFeatureErrorFilletNoFace 11 = Face for fillet/chamfer does not exist
swFeatureErrorFilletNoLoop 10 = Loop for fillet/chamfer does not exist
swFeatureErrorFilletRadiusEliminateElement 17 = Specified radius would eliminate one of the elements
swFeatureErrorFilletRadiusTooBig 18 = Radius is too big or the elements are tangent or nearly tangent
swFeatureErrorFilletRadiusTooBig2 19 = Not used
swFeatureErrorFilletRadiusTooSmall 15 = Radius too small
swFeatureErrorMateBroken 48 = One or more mate entities were suppressed
swFeatureErrorMateDanglingGeometry 43 = Mate points to dangling geometry
swFeatureErrorMateEntityFailed 45 = Mating is not supported for one of the components or one of the components cannot currently be modified
swFeatureErrorMateEntityNotLinear 44 = Non-linear edges cannot be used for mating
swFeatureErrorMateFailedCreatingSurface 40 = Mating surface type is not supported
swFeatureErrorMateIlldefined 47 = This mate cannot be solved. Consider:
  • Deleting this mate.

  • Moving the assembly closer to the desired solution with dragging. 

  • Adding more mates to further define the assembly.

  • Changing the mating scheme

swFeatureErrorMateInvalidEdge 38 = One of the edges of this mate is suppressed, invalid, or no longer present
swFeatureErrorMateInvalidEntity 41 = One of the entities of this mate is suppressed, invalid, or no longer present
swFeatureErrorMateInvalidFace 39 = One of the faces of this mate is suppressed, invalid, or no longer present
swFeatureErrorMateOverdefined 46 = This mate is over-defining the assembly; consider deleting some of the over-defining mates
swFeatureErrorMateUnknownTangent 42 = Tangent not satisfied
swFeatureErrorNone 0 = No error
swFeatureErrorPartialEdgeFilletCrossOverEndCondition 62 = End points cross over and result in a zero thickness fillet
swFeatureErrorPartialEdgeFilletFailedToRepair 68 = There are no references to repair
swFeatureErrorPartialEdgeFilletInvalidOffsetValue 61 = Total offset from start point and end point must be less than 100%
swFeatureErrorPartialEdgeFilletInvalidReferenceEntity 64 = Reference entity is invalid
swFeatureErrorPartialEdgeFilletMissingReferenceEntity 63 = Reference entity is missing
swFeatureErrorPartialEdgeFilletMultiProjectionPoint 67 = Failed to find a unique point for projection of reference offset
swFeatureErrorPartialEdgeFilletNoEndEdge 56 = Failed to find end edge
swFeatureErrorPartialEdgeFilletNoIntersection 52 = No intersection between reference entity and fillet edge
swFeatureErrorPartialEdgeFilletNoMainEdge 57 = Failed to find the fillet/chamfer edge
swFeatureErrorPartialEdgeFilletNoPropagateEdges 54 = Failed to find propagate edges
swFeatureErrorPartialEdgeFilletNoReferenceEntity 59 = Select a sketch point, reference point, reference plane, or planar face
swFeatureErrorPartialEdgeFilletNoStartEdge 55 = Failed to find a start edge
swFeatureErrorPartialEdgeFilletNotSupported 65 = Partial edge fillet is not supported
swFeatureErrorPartialEdgeFilletNotSupportedForClosedLoop 66 = Some edges form closed loops; partial edge fillet does not support closed loops
swFeatureErrorPartialEdgeFilletOffsetTooBig 58 = The fillet offset is too large
swFeatureErrorPartialEdgeFilletTooManyRefEntities 60 = Too many reference entities selected
swFeatureErrorPartialEdgeFilletUpdateFailed 53 = Failed to update the partial edge data
swFeatureErrorUnknown 1 = Unknown error
swSketchErrorExtRefFail 51 = Sketch error

(3)第三个为swFeatureNameID_e,这个枚举的含义为特征的名称ID,下面是官方的具体枚举值:

Member Description
swFmAbsoluteView Absolute view
swFmAEM3DContact 3D contact
swFmAEMGravity Gravity
swFmAEMLinearDamper Linear damper
swFmAEMLinearForce Linear force
swFmAEMLinearMotionSpring Linear motion spring
swFmAEMLinearMotor Linear motor
swFmAEMLinearSpring Linear spring
swFmAEMRotationalMotor Rotational motor
swFmAEMTorque Torque
swFmAEMTorsionalDamper Torsional damper
swFmAEMTorsionalMotionSpring Torsional motion spring
swFmAEMTorsionalSpring Torsional spring
swFmAttribute Attribute
swFmAuxiliaryView Auxiliary view
swFmBaseBody Base body
swFmBaseFlange Base flange
swFmBlend Blend
swFmBlendCut Blend cut
swFmBomTableFeature BOM table feature
swFmBoss Boss
swFmBoundingBox BoundingBox
swFmBreakCorner Break corner
swFmCavity Cavity
swFmCenterMark Center mark
swFmChamfer Chamfer
swFmCirPattern Circular pattern
swFmCoordinateSystem Coordinate system
swFmCornerTrim Corner trim
swFmCosmeticThread Cosmetic thread
swFmCrossBreak Cross break
swFmCurvePattern CurvePattern
swFmCut Cut
swFmDerivedLPattern Derived pattern
swFmDetailCircle Detail circle
swFmDetailView Detail view
swFmDimPattern DimPattern
swFmDraft Draft
swFmDrSectionLine Section line
swFmDrSheet Drawing sheet
swFmEdgeFlange Edge flange
swFmExtrusion Extrusion
swFmFeatureFolder Feature folder
swFmFillet Fillet
swFmFillPattern APattern
swFmFlatPattern Flat pattern
swFmFlattenBends Flatten bends
swFmFormToolInstance Form tool instance
swFmGroundPlane GroundPlane
swFmHoleTableFeature Hole table feature
swFmHoleWzd Hole wizard
swFmImported Imported
swFmLibraryFeature Library feature
swFmLocalChainPattern LocalChainPattern
swFmLocalCirPattern LocalCirPattern
swFmLocalCurvePattern LocalCurvePattern
swFmLocalLPattern LocalLPattern
swFmLocalSketchPattern LocalSketchPattern
swFmLPattern Linear pattern
swFmMateCamTangent Tangent mate
swFmMateCoincident Coincident mate
swFmMateConcentric Concentric mate
swFmMateDistanceDim Distance mate
swFmMateGearDim Gear mate
swFmMateHinge Hinge mate
swFmMateLinearCoupler Linear coupler mate
swFmMateLock Lock mate
swFmMateParallel Parallel mate
swFmMatePerpendicular Perpendicular mate
swFmMatePlanarAngleDim Angle mate
swFmMateProfileCenter Profile center mate
swFmMateRackPinionDim Rack and pinion mate
swFmMateScrew Screw mate
swFmMateSlot Slot mate
swFmMateSymmetric Symmetric mate
swFmMateTangent Tangent mate
swFmMateUniversalJoint Universal joint mate
swFmMateWidth Width mate
swFmMirrorComponent Mirror component
swFmMirrorPattern Mirror pattern
swFmMirrorSolid Mirror solid
swFmNormalCut Sheet metal normal cut
swFmOneBend One bend
swFmProcessBends Process bends
swFmProfileFeature Profile feature
swFmRefAxis Reference axis
swFmRefCurve Reference curve
swFmReference Reference
swFmReferenceCurve Reference curve
swFmRefPlane Reference plane
swFmRefSurface Reference or sweep surface
swFmRelativeView Relative view
swFmRevCut Reference cut
swFmRevisionTableFeature Revision table feature
swFmRevolution Revolve
swFmSectionAssemView Section view of assembly
swFmSectionPartView Section view of part
swFmSheetMetal Sheet metal
swFmShell Shell
swFmSketchBend Sketch bend
swFmSketchHole Sketch hole
swFmSketchPattern SketchPattern
swFmSM3dBend Sheet metal 3D bend
swFmSolidBodyFolder Solid body folder
swFmStock Stock
swFmSurfaceBodyFolder Surface body folder
swFmSurfCut Surface cut
swFmSweep Sweep boss
swFmSweepCut Sweep cut
swFmSweepThread Sweep thread
swFmTabAndSlot Tab and Slot
swFmTablePattern TablePattern
swFmThicken Thicken
swFmThickenCut Thicken cut
swFmUnfoldedView Unfolded view
swFmVarFillet Variable fillet
swFmWeldMemberFeat Weldment feature

本篇文章介绍的就是这三种枚举,更多的枚举介绍,我们下篇文章再见。