Add ACADM BomItem

Discussion in 'AutoCAD' started by Jim Shipley, Nov 22, 2004.

  1. Jim Shipley

    Jim Shipley Guest

    [Using AutoCAD Mechanical 2005]:

    Is it possible to ADD a BOM item to the ACADM BOM with VBA?

    All I want to do is add items to the (MAIN) BOM. I don't have any part
    references to relate them to, just entries in the BOM table. For some
    reason I am unable to do this!


    Dim oSymBBMgr As SymBBAuto.McadSymbolBBMgr
    Dim oBOMMgr As SymBBAuto.McadBOMMgr
    Dim oBOM As SymBBAuto.McadBOM
    Dim oBOMItem As SymBBAuto.McadBOMItem
    Dim oTarget As AutoCAD.AcadBlock

    Set oSymBBMgr =
    MyDwg.Application.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr")
    Set oBOMMgr = oSymBBMgr.BOMMgr
    Set oTarget = ThisDrawing.ModelSpace
    Set oBOM = oBOMMgr.GetBOMTable(oTarget, "MAIN")
    Set oBOMItem = oBOM.AddUnassociatedItem("2", 3)



    thanks,
    Jim Shipley
     
    Jim Shipley, Nov 22, 2004
    #1
  2. Hey Jim!

    All items in the BOM must have part references associated with them because
    the BOM is semi-aware. AddUnAssocated only means there is no geometry
    connected to the part ref. All you need to do is add a part ref somewhere
    in the drawing.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Nov 24, 2004
    #2
  3. Jim Shipley

    Jim Shipley Guest

    Thanks Mike-

    I'm not sure how to add a part ref. There are several methods
    (McadBOMItem.AddReference), but it takes a 'reference' variable as an
    argument. Not sure what this is or how to create it.

    How do you add a part ref to the drawing?

    Thanks,
    Jim
     
    Jim Shipley, Nov 24, 2004
    #3
  4. How do you add a part ref to the drawing?
    Dim pt As Variant
    pt = ThisDrawing.Utility.GetPoint(, "Location for ampartref: ")
    pt = ThisDrawing.Utility.TranslateCoordinates(pt, acUCS, acWorld, False)
    Dim mpartref As McadPartReference
    Set mpartref = ThisDrawing.ModelSpace.AddCustomObject("AcmPartRef")
    mpartref.Origin = pt

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Nov 29, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.