.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get position and bounding box of a BOM table

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
457 Views, 1 Reply

Get position and bounding box of a BOM table

Hello,

 

I need to get the position and boundig box of the table "bill of materials". Any idea?

 

  Public Shared Sub GetPosicionBOM()
    Dim acadApp As AcadApplication = Nothing
    Dim symMgr As McadSymbolBBMgr = Nothing
    Dim symBOMs As McadBOMs = Nothing

    acadApp = DirectCast(Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication, AcadApplication)
    symMgr = acadApp.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr")
    symBOMs = symMgr.BOMMgr.GetAllBOMTables(True)


    If symBOMs IsNot Nothing AndAlso symBOMs.Count > 0 Then
      For Each symBOM As McadBOM In symBOMs

        ' I neet to get the position and bounding box of the object symBOM

      Next
    End If

    acadApp = Nothing
    symMgr = Nothing
    symBOMs = Nothing
  End Sub

 

thansk,

 

Ane

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

 

Finally I found the solution;

 

  <CommandMethod("PartListBoundingBox")> _
  Public Sub PartListBoundingBox()
    Dim doc As Document = Application.DocumentManager.MdiActiveDocument
    Dim bt As BlockTable = Nothing
    Dim btr As BlockTableRecord = Nothing
    Dim objId As ObjectId = Nothing
    Dim partList As Entity = Nothing

    Using tr As Transaction = doc.TransactionManager.StartTransaction

      bt = DirectCast(tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead), BlockTable)
      btr = DirectCast(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead), BlockTableRecord)

      If btr IsNot Nothing Then
        For Each objId In btr
          If objId.ObjectClass.DxfName.ToUpper = "ACMPARTLIST" Then

            partList = tr.GetObject(objId, OpenMode.ForRead)
            If partList.Bounds.HasValue Then
              MsgBox("MinPoint (" & partList.Bounds.Value.MinPoint(0).ToString & "," & partList.Bounds.Value.MinPoint(1) & ")" & Chr(13) & _
                          "MaxPoint (" & partList.Bounds.Value.MaxPoint(0).ToString & "," & partList.Bounds.Value.MaxPoint(1) & ")")
              Exit For
            End If
          End If
        Next
      End If

      tr.Commit()
    End Using

  End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost