ning58 发表于 2017-1-8 21:50:34

InsertModelAnnotations3。

本帖最后由 ning58 于 2017-1-21 08:44 编辑

使用好多次,没有很好掌握InsertModelAnbnotations3语句。
value = instance.InsertModelAnnotations3(Option, Types, AllViews, DuplicateDims, HiddenFeatureDims, UsePlacementInSketch)


Private Sub ll()
   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2
       Set SwApp = Application.SldWorks
       Set SwModel = SwApp.ActiveDoc
   Dim SwDraw As DrawingDoc
       Set SwDraw = SwModel
       With SwDraw
          .InsertModelAnnotations3 0, swInsertNotes, False, True, True, True
          '.InsertModelAnnotations3 0, 33352, False, True, True, True
          .InsertModelAnnotations3 0, swInsertDimensionsMarkedForDrawing, False, True, True, True
       End With
      
      
End Sub


Private Sub ll1()
   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2
       Set SwApp = Application.SldWorks
       Set SwModel = SwApp.ActiveDoc
   Dim SwDraw As DrawingDoc, Annotations
       Set SwDraw = SwModel
       With SwDraw
          Annotations = .InsertModelAnnotations3(0, swInsertNotes, False, True, True, True)
       End With
   Dim SwNote As Note, SwAnn As Annotation
       For ii = 0 To UBound(Annotations)
            Set SwAnn = Annotations(ii)
            Debug.Print SwAnn.GetName, SwAnn.GetType,
            Set SwNote = SwAnn.GetSpecificAnnotation
            Debug.Print SwNote.GetBalloonStyle, SwNote.GetText
            If SwNote.GetBalloonStyle = 10 Then
                SwAnn.Select False
                SwModel.EditDelete
            End If
       Next ii
      
End Sub


***************************
语句中的Option选择
Member Description
swImportModelItemsFromEntireModel   
swImportModelItemsFromSelectedFeature   
swImportModelItemsFromSelectedComponent   
swImportModelItemsFromAssemblyOnly

************************
语句中的Types的选择
Member Description
swInsertCThreads 1 or 0x1
swInsertDatums 2 or 0x2
swInsertDatumTargets 4 or 0x4
swInsertDimensions 8 or 0x8
swInsertInstanceCounts 16 or 0x10
swInsertGTols 32 or 0x20
swInsertNotes 64 or 0x40
swInsertSFSymbols 128 or 0x80
swInsertWelds 256 or 0x100
swInsertAxes 512 or 0x200
swInsertCurves 1024 or 0x400
swInsertPlanes 2048 or 0x800
swInsertSurfaces 4096 or 0x1000
swInsertPoints 8192 or 0x2000
swInsertOrigins 16384 or 0x4000
swInsertDimensionsMarkedForDrawing 32768 or 0x8000
swInsertHoleWizardProfileDimensions 65536 or 0x10000
swInsertHoleWizardLocationDimensions 131072 or 0x20000
swInsertRefPoints 262144 or 0x40000
swInsertDimensionsNotMarkedForDrawing 524288 or 0x80000
swInsertholeCallout 1048576 or 0x100000
swInsertWeldBeads 2097152 or 0x200000
swInsertSketches 4194304 or 0x400000
swInsertWeldBeads_ET


recieve185 发表于 2017-3-11 15:46:49

我也是这个问题,录制宏后再运行不起作用 加个QQ交流一下不?
页: [1]
查看完整版本: InsertModelAnnotations3。