API - Deleting model dimensions from drawing

Discussion in 'SolidWorks' started by lcifers, Jul 18, 2005.

  1. lcifers

    lcifers Guest

    I'm working on a project in which I:

    - Import model items into a view (I'm mostly after dimensions)

    - Scan though the dimensions that were imported and delete
    some dimensions based on their prefix.

    The part I am having trouble with is deleting dimensions. I'm trying
    to use SelectByID like this:

    MyDim = MyDispDim.GetDimension
    swDrawing.ActivateView(MyView.Name)
    swDrawing.SelectByID(MyDim.FullName, "DIMENSION",
    0, 0, 0)

    swdrawing.EditDelete()

    But it doesn't work. I don't get the full name. For example, if the
    full name is:

    "Outer Land@Sketch1@DrawingTemplate1-SectionPart-1-1@Drawing View3"

    I get a value of :

    "Outer Land@Sketch1@SB025AZ0_Outer.Part"

    So the dimension is not selected.

    Does anyone know how to the correct name, or are there any other ideas
    out there for deleting these dimensions?

    Thanks.

    - Luther
     
    lcifers, Jul 18, 2005
    #1
  2. lcifers

    lcifers Guest

    I found a solution, but for anyone else out there wondering:...
    (From SW API Support - this works)

    Since you already have the DisplayDimension, please realize that this
    "is-a" Annotation.
    You can access the Annotation, calling:

    DisplayDimension::GetAnnotation


    and the Annotation interface comes with a method:

    Annoation::Select3


    You can call this directly, without the need for
    ModelDocExtension::SelectByID2().

    Once you have selected the dimension, call:

    ModelDoc::DeleteSelection


    to delete them in 1 go.
     
    lcifers, Jul 18, 2005
    #2
  3. lcifers

    TOP Guest

    It would seem you could modify the code in:
    Get Assembly Component From Selected Entity Example (VB)
    to do what you want also.
     
    TOP, Jul 18, 2005
    #3
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.