1 Reply Latest reply on Nov 26, 2014 4:16 AM by Pranjal Jamsandekar

    How to make the standard three-view created by 3rd angle in Hidden lines visible ?

    Pranjal Jamsandekar

      I have already written the code for the same , but after running the code still it is not showing

      it in Hidden lines visible. In the below code it is been highlighted.

       

      Also please tell me how to create the code to display the isometric view in drafting sheet in 'Shaded with edges'

       

       

      Private Sub cmdRun_Click()
          Dim swModel As SldWorks.ModelDoc2
          Dim swDraw As SldWorks.DrawingDoc
         
          Set swApp = Application.SldWorks
          Set swModel = swApp.ActiveDoc
         
         
          'IDRAWINGDOC
          'Create new drawing
          Dim strTemplatePath As String
          strTemplatePath = swApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swDefaultTemplateDrawing)
          Set swModel = swApp.NewDocument(strTemplatePath, swDwgPapersUserDefined, 0.594, 0.42)
          Set swDraw = swModel
         
         
          'ISHEET
          'Setup sheet format
          swDraw.SetupSheet5 "Sheet1", 12, 12, 1, 4, False, strFormatPath, 0.594, 0.42, "Default", True
         
         
          'Change name of sheets
          Dim swSheet As SldWorks.Sheet
          Dim vSheetNames As Variant
          Dim i As Integer
          vSheetNames = swDraw.GetSheetNames
          For i = 0 To UBound(vSheetNames)
              Set swSheet = swDraw.Sheet(vSheetNames(i))
              If i = 0 Then swSheet.SetName "BRACKET:PH:"
          Next i
         
         
          'IVIEW
          'Add isometric view of solid model on sheet
          Dim swView As SldWorks.View
          Dim swIsoView As SldWorks.View
          Set swView = swDraw.CreateDrawViewFromModelView3(strModelPath, "*Isometric", 0.35, 0.097, 0)
          Set swIsoView = swView
          swDraw.ViewDisplayShaded
         
         
         'Change view scale to 1:1
          Dim dblScale(1) As Double
          dblScale(0) = 1
          dblScale(1) = 1
          swView.ScaleRatio = dblScale

         
          'Add standard three-view on sheet
          swDraw.Create3rdAngleViews2 strModelPath
         'swDraw.ViewDisplayHidden
         
         
          'Change sheet scale
          Set swSheet = swDraw.GetCurrentSheet
          swSheet.SetScale 1, 1, True, True

          'IANNOTATION
          'Add dimensions
          swDraw.InsertModelAnnotations3 swImportModelItemsFromEntireModel, swInsertDimensionsMarkedForDrawing, True, True, False, True
         
           'Rebuild
          'swModel.ForceRebuild3 True
         
          'Select all display dimensions
          Dim swDispDim As SldWorks.DisplayDimension
          Dim swDispData As SldWorks.DisplayData
          Dim vViews As Variant
          swModel.ClearSelection2 True
          vViews = swSheet.GetViews
          For i = 0 To UBound(vViews)
              Set swView = vViews(i)
              Set swDispDim = swView.GetFirstDisplayDimension5
              While Not swDispDim Is Nothing
                  swModel.Extension.SelectByID2 swDispDim.GetNameForSelection, "DIMENSION", 0, 0, 0, True, 0, Nothing, 0
                  Set swDispData = swDispDim.GetDisplayData
                  Set swDispDim = swDispDim.GetNext5
              Wend
          Next i
            
            
          'Reposition dimensions
          swModel.Extension.AlignDimensions swAlignDimensionType_AutoArrange, 0.06

      End Sub

        • Re: How to make the standard three-view created by 3rd angle in Hidden lines visible ?
          Pranjal Jamsandekar

          Could anybody please tell how to get Isometric view in "Shaded with Edges" and  3rd angle view in "Hidden lines visible".

          Also please find the below code for the same I have created. I am not getting were I am going wrong.

           

          Dim swModel As SldWorks.ModelDoc2
              Dim swDraw As SldWorks.DrawingDoc
             
              Set swApp = Application.SldWorks
              Set swModel = swApp.ActiveDoc
             
             
              'IDRAWINGDOC
              'Create new drawing
              Dim strTemplatePath As String
              strTemplatePath = swApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swDefaultTemplateDrawing)
              Set swModel = swApp.NewDocument(strTemplatePath, swDwgPapersUserDefined, 0.594, 0.42)
              Set swDraw = swModel
             
             
              'ISHEET
              'Setup sheet format
              swDraw.SetupSheet5 "Sheet1", 12, 12, 1, 4, False, strFormatPath, 0.594, 0.42, "Default", True
             
             
              'Change name of sheets
              Dim swSheet As SldWorks.Sheet
              Dim vSheetNames As Variant
              Dim i As Integer
              vSheetNames = swDraw.GetSheetNames
              For i = 0 To UBound(vSheetNames)
                  Set swSheet = swDraw.Sheet(vSheetNames(i))
                  If i = 0 Then swSheet.SetName "BRACKET:PH:"
              Next i
             
             
              'IVIEW
              'Add isometric view of solid model on sheet
              Dim swView As SldWorks.View
              Dim swIsoView As SldWorks.View
              Set swView = swDraw.CreateDrawViewFromModelView3(strModelPath, "*Isometric", 0.35, 0.097, 0)
              Set swIsoView = swView
             
              If swApp.GetUserPreferenceIntegerValue(swUserPreferenceIntegerValue_e.swHiddenEdgeDisplayDefault) = 1 Then
             
                 swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swHiddenEdgeDisplayDefault, swDisplayMode_e.swSHADED

              Else
                 swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swHiddenEdgeDisplayDefault, swDisplayMode_e.swSHADED
                 
              End If
              
             
             'Change view scale to 1:1
              Dim dblScale(1) As Double
              dblScale(0) = 1
              dblScale(1) = 1
              swView.ScaleRatio = dblScale
             

              'Add standard three-view on sheet
              swDraw.Create3rdAngleViews2 strModelPath
              swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swHiddenEdgeDisplayDefault,     swDisplayMode_e.swHIDDEN_GREYED
              'swDraw.ViewDisplayHiddengreyed
             
             
              'Change sheet scale
              Set swSheet = swDraw.GetCurrentSheet
              swSheet.SetScale 1, 1, True, True
             
             
               'IANNOTATION
              'Add dimensions
              swDraw.InsertModelAnnotations3 swImportModelItemsFromEntireModel, swInsertDimensionsMarkedForDrawing, True, True, False, True
             
               'Rebuild
              'swModel.ForceRebuild3 True
             
              'Select all display dimensions
              Dim swDispDim As SldWorks.DisplayDimension
              Dim swDispData As SldWorks.DisplayData
              Dim vViews As Variant
              swModel.ClearSelection2 True
              vViews = swSheet.GetViews
              For i = 0 To UBound(vViews)
                  Set swView = vViews(i)
                  Set swDispDim = swView.GetFirstDisplayDimension5
                  While Not swDispDim Is Nothing
                      swModel.Extension.SelectByID2 swDispDim.GetNameForSelection, "DIMENSION", 0, 0, 0, True, 0, Nothing, 0
                      Set swDispData = swDispDim.GetDisplayData
                      Set swDispDim = swDispDim.GetNext5
                  Wend
              Next i
                
                
              'Reposition dimensions
              swModel.Extension.AlignDimensions swAlignDimensionType_AutoArrange, 0.06
             
             
              'Balloon the dimensions select standard three-views
              'Dim swFeat As SldWorks.Feature
              'Set swFeat = swDraw.FeatureByName