Dimension in Draft

 

Hi all....

 

I have a problem ..

 

 

There is a problem with the output dimension

As shown in the attached image where the view is wrong with dimensionsAsshown inthe attachedimagewherethe viewis wrongwithdimensions

 

 

Dimensioningof the viewthat matches thewaytothe lineis missing?

 

 

The sourceundera program thatautomaticallyprints thedrawing'ssource.

Seemeandhelp would be appreciated

 

 

Solid edge st2

 

vb6.0

 

//-------------------------------------------------------

  strParFile = "C:\Users\yheom\Desktop\????11.dft"

 Set objApp1 = GetObject(, "SolidEdge.Application")

 

 Set objDftDoc = objApp1.Documents.Add("SolidEdge.DraftDocument", strParFile)

 

 Set objSections = objDftDoc.Sections

 For i = 1 To objSections.Count

  Set objSection = objSections.Item(i)

  Set objSectionSheets = objSection.Sheets

 Next i

 

 'For i = 1 To objSectionSheets.Count

  'Set objSheet1 = objSectionSheets.Item(i)

 'Next i

 

 

 Set objSection = objSections.WorkingSection

 'Set objSection = objSections.BackgroundSection

 Set objSheets = objDftDoc.Sheets

 

 ' strParFile = "C:\Users\yheom\Desktop\????11.dft"

 'objSheet1 = objSheets.AddSheet("?????", SheetSectionTypeConstants.igWorkingSection)

 

 Set objSheet1 = objDftDoc.ActiveSheet

  objSheet1.Visible = True

 

 'Set objSheet1 = objDftDoc.ActiveSheet

  objSheet1.SheetSetup.SetDefaultDrawingViewScale 1, 20

  objSheet1.Visible = True

 objSheet1.SheetSetup.SetScale 1, 20

 objSheet1.SheetSetup.GetScale px, py

 objSheet1.Activate

 

 'Call objSheet1.SheetSetup.SetDefaultDrawingViewScale(0.5, 0.5)

 Set objSections = objDftDoc.Sections

 

 Set sheetwindow1 = objApp1.ActiveWindow

 

 

 px = objSheet1.SheetSetup.SheetHeight * 1000

 py = objSheet1.SheetSetup.SheetWidth * 1000

 

 

 

 MsgBox px & "," & py

 Set objDrawingObjects = objSheet1.DrawingObjects

 

   Set objDrawingViews = objSheet1.DrawingViews

 

  'objDrawingViews.Align

 

  cnt = objDrawingViews.Count

 

  For i = 1 To cnt

 

   Call objDrawingViews.Item(i).Update

 

     Set objDrawingView = objDrawingViews.Item(i)

     'objDrawingView.SetOrigin dx, dy

    Call objDrawingView.Range(xMin, xMax, yMin, yMax)

    objDrawingView.ScaleDimensionsAndAnnotations = True

 

    '*?? ?? ?? ?? ??

    'objDrawingView.SetOrigin 1, 2

    '*----------------------

 

    For m = 1 To objDrawingView.DVLines2d.Count

        objDrawingView.DVLines2d.Item(m).ModelMember.ShowHiddenEdges = False

        objDrawingView.DVLines2d.Item(m).ModelMember.ShowEdgesHiddenByOtherParts = False

        objDrawingView.DVLines2d.Item(m).ModelMember.ShowTangentEdges = False

    Next m

 

   ' For m = 1 To objDrawingView.DVCircles2d.Count

   '     objDrawingView.DVCircles2d.Item(m).ModelMember.ShowHiddenEdges = False

   '     objDrawingView.DVCircles2d.Item(m).ModelMember.ShowEdgesHiddenByOtherParts = False

   '     objDrawingView.DVCircles2d.Item(m).ModelMember.ShowTangentEdges = False

   ' Next m

 

  '  For m = 1 To objDrawingView.DVArcs2d.Count

  '      objDrawingView.DVArcs2d.Item(m).ModelMember.ShowHiddenEdges = False

  '      objDrawingView.DVArcs2d.Item(m).ModelMember.ShowEdgesHiddenByOtherParts = False

  '      objDrawingView.DVArcs2d.Item(m).ModelMember.ShowTangentEdges = False

  '  Next m

 

    Call objDrawingView.Update

   Next i

 

 

 

  For i = 1 To cnt

    Set objDrawingView = objDrawingViews.Item(i)

    Call objDrawingView.Update

    objDftDoc.ActiveSheet.Activate

    objDrawingView.Update

 

    Set sedims = objDftDoc.ActiveSheet.Dimensions

 

 

    ReDim dblX1(objDrawingView.DVLines2d.Count)

    ReDim dblY1(objDrawingView.DVLines2d.Count)

 

 

    For m = 1 To objDrawingView.DVLines2d.Count

 

    Set line = objDrawingView.DVLines2d.Item(m)

 

    objDrawingView.RetrieveDimensions True

 

    If line.EdgeType = seModelEdgeType Then

     Call line.GetStartPoint(dblX1(m), dblY1(m))

        If m > 1 Then

         If (line.Length) * 1000 > 20 Then

 

            dx = (dblX1(m) - dblX1(m - 1)) * (dblX1(m) - dblX1(m - 1))

            dy = (dblY1(m) - dblY1(m - 1)) * (dblY1(m) * -dblY1(m - 1))

            dd = dx + dy

            dd = Abs(dd)

            dd = Sqr(dd)

            dd = dd * 1000

 

            If dd > 20 Then

             'If line.Length > 30 Then

             Set SEdim = objSheet1.Dimensions.AddLength(line)

 

             'End If

            End If

         End If

 

        ElseIf m = 1 Then

          Set SEdim = objSheet1.Dimensions.AddLength(line)

             SEdim.BreakPosition = igDimBreakCenter

             SEdim.BreakDistance = 0.5

        End If

    End If

  Next m

 

     ReDim dblX2(objDrawingView.DVCircles2d.Count)

     ReDim dblY2(objDrawingView.DVCircles2d.Count)

 

  For m = 1 To objDrawingView.DVCircles2d.Count

 

     Set line2 = objDrawingView.DVCircles2d.Item(m)

   If line2.EdgeType = seModelEdgeType Then

 

     Call line2.GetCenterPoint(dblX2(m), dblY2(m))

 

     If m = 1 Then

      Set SEdim = sedims.AddCircularDiameter(line2)

     ElseIf m > 1 Then

      If (line2.Diameter) * 1000 > 15 Then

        dx = (dblX2(m) - dblX2(m - 1)) * (dblX2(m) - dblX2(m - 1))

        dy = (dblY2(m) - dblY2(m - 1)) * (dblY2(m) * -dblY2(m - 1))

        dd = dx + dy

        dd = Abs(dd)

        dd = Sqr(dd)

        dd = dd * 1000

 

        If dd > 20 Then

          Set SEdim = sedims.AddCircularDiameter(line2)

        End If

      End If

     End If

   End If

  Next m

 

 

     ReDim dblX3(objDrawingView.DVArcs2d.Count)

     ReDim dblY3(objDrawingView.DVArcs2d.Count)

 

  For m = 1 To objDrawingView.DVArcs2d.Count

     Set arc1 = objDrawingView.DVArcs2d.Item(m)

 

   If arc1.EdgeType = seModelEdgeType Then

     Call arc1.GetCenterPoint(dblX3(m), dblY3(m))

 

     If m = 1 Then

      Set SEdim = sedims.AddLength(arc1)

     ElseIf m > 1 Then

      If (arc1.Radius) * 1000 > 30 Then

        dx = (dblX3(m) - dblX3(m - 1)) * (dblX3(m) - dblX3(m - 1))

        dy = (dblY3(m) - dblY3(m - 1)) * (dblY3(m) * -dblY3(m - 1))

        dd = dx + dy

        dd = Abs(dd)

        dd = Sqr(dd)

        dd = dd * 1000

 

        If dd > 30 Then

          Set SEdim = sedims.AddLength(arc1)

          Set ObjDimStyle = SEdim.Style

        End If

      End If

     End If

    End If

  Next m

 

    objDftDoc.ActiveSheet.Activate

    objDrawingView.Update

 Next i

 

 

Posted by: eom younghwee
Post date: 6/28/2011 7:04:28 PM

2 REPLIES

RE: Dimension in Draft

try this

 

Set SEdim = objSheet1.Dimensions.AddLength(line.reference)

 

eric

 

Posted by: BONNAUDET eric
Post date: 7/6/2011 11:52:13 PM

RE: Dimension in Draft

Thank you very much.

 

I saw to try was successful.

 

One API is really thanks so troubled.

 

Posted by: eom younghwee
Post date: 7/7/2011 1:42:35 PM