Showing results for 
Search instead for 
Did you mean: 

Displaying annotations

Valued Contributor
Valued Contributor

Dear experts.


I'm writing an app in which the user can select a directory with assemblies and the it will generate the drafts with the views for them. For the same view of each different assembly, I'd like to show the same annotations.


I'm trying to select the annotations in these fashions: 

Through index / Add length: 

dvLine2d = dvLines2d.Item(50);

 Througth a loop and some condition / AddDistanceBetweenObjects:

foreach (SolidEdgeDraft.DVLine2d dvLine2d in dvLines2d)
                if (dvLine2d.Name == "DVLine2d 1393")
                    dvL = dvLine2d;

                if (dvLine2d.Name == "DVLine2d 1722")
                    dvL2 = dvLine2d;
            dimension = dimensions.AddDistanceBetweenObjects(dvL, 0.0, 0.0, 0.0, false, dvL2, 0.0, 0.00, 0.0, false);

 The models differ in size(Height, Width) mainly. The problem is that because of this everything changes in each different model.(line names, indexes etc), giving me unwanted annotations and making it impossible to have something hard coded to select the lines to dimension. 


I'm thinking about only positioning the views and letting the designers put the anottations or using Retrieve Dimensions and convince them to put the dimensions right after modeling, but 

giving more work to them is not desirable. 


The question is: How do you experts would deal with a scenario like this? Whats' the best approach? Is there any kind of configuration, solution, workaround(anything that I don't know) to ease the placement of annotations?


Thanks for you help!


Re: Displaying annotations

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

The hard-coded approach is always the worst.

You should dynamically find the drawing view objects which you want to measure. If you want to measure the overall height of an object in a side view, you may want to find the hghest and lowest drawing view object and measure between them. If you know, that your object has planar faces on the top and base, you could even simplify your code by only searching in the DVLines2d collection for the maximum and minimum value.

In summary:

* find the drawing objects dynamically

* the right condition for your object depends on what you are going to annotate

Re: Displaying annotations

Valued Contributor
Valued Contributor

Hi, Martin.


I'm following your tips already and having improvements in finding the right annotations for the models dinamycally, but I think I'll need more testing.


If I have any news or questions I'll post here.


Thanks a bunch for your response!!!

Re: Displaying annotations

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Martin I wished I could give you two kudos for I also used this discussion to answer another question here: