API - Deleting model dimensions from drawing

Jul 18, 2005 2 Replies

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



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.

It would seem you could modify the code in: Get Assembly Component From Selected Entity Example (VB) to do what you want also.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required