Showing results for 
Search instead for 
Did you mean: 


Valued Contributor
Valued Contributor

Hello, everyone!


I'm trying to display a dimension in my drawing view and I thought it was going to look this way:


I used the method dimensions.AddDistanceBetweenObjects(dv.DVLines2d.Item(50), 0.0, 0.0, 0.0, false, dv.DVLines2d.Item(140), 0.0, 0.00, 0.0, false); and the way the dimension is displayed is completely different, outside the drawingView:




I tryed to alter the method parameters(x, y, z) with no success. I also tryed to set some properties of the dimension object but it didn't work either. Does anybody know what to do so that the dimension is displayed in it's right place(next to the drawingView)?


Thx for your help!


Re: dimensions.AddDistanceBetweenObjects

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

You were probably using the wrong Dimensions collection.

Instead of using the Dimensions collection from the ActiveSheet (or any Sheet of the document), you should use the Dimensions from the Sheet which can be found in your DrawingView!!

Re: dimensions.AddDistanceBetweenObjects

Valued Contributor
Valued Contributor

You' re right Martin! 


I suspected it but I couldn't resolve.


Thx a lot for your help!

Re: dimensions.AddDistanceBetweenObjects

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi Martin,

I don#t agree with you. Using the Sheet of the DrawingView object will generate a Dimension in the Drawing View but not on the Sheet. The the same as if the use will draw into the View from the User Interface.

Use the Reference of the DVLines to get the Dimension on the Drawing sheet and reference to elements in the View:


SheetDims.AddDistanceBetweenObjects(dvLine1.Reference, x1, y1 + 0.01, 0, True,
                                            dvLine2.Reference, x2, y1 + 0.01, 0, False)

The x and y coordinates must be in Sheet coordinate system, so transform coordinates from the line elements from view to sheet:


 ThisDV.ViewToSheet(vx, vy, x1, y1)


The exampe above will add a horizontal dimension for 2 lines parallel to x axis


Hope this helps




Re: dimensions.AddDistanceBetweenObjects

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor



Since you are using hard coded values for the DVLine items, it should also be possible to specify the vertical DVLine between which you are placing the dimension, if the geometry of assembly permits.




Just for the purpose of spacing, I used this little loop:


oDVLines = oView.DVLines2d
For Each oDVLine In oDVLines

At this moment, oDims is oSheet.Dimensions.

This resulted in dimensioning of all DVLines and the spacing appeared like this:




After manually removing most of the dimension clutter, the spacing for just the two important dimensions appears like this:



After this, based on Martin's suggestion I changed the definition of oDims to oView.Sheet.Dimensions.

Now the dimensions are supposed to appear inside and be part of the oView itself.

So running the little loop again and concentrating on the dimension spacing:



Finally, after manually Draw in View command, deleting unwanted dimensions and closing the view, the dimension spacing inside of the view still look acceptable on the sheet:



What are your findings based on sugegstions from Martin and JB's comments?

Please share.



Re: dimensions.AddDistanceBetweenObjects

Valued Contributor
Valued Contributor


Thx everybody for trying to help me!


Here follow my impressions:


JB: Unfortunatelly, I didn't manage to get the correct dimensions with this approach yet. I know I problably misundertood something, but I'll keep trying. You got a very sensible solution.


Tushar: At this time, Martin's solutions is working fine for me. I don't know if the fact of the dimensions being linked to the DrawingView instead of the Sheet(as JB stated) will bring some sort of problem in the future. I hope not.


As I discover new thinks I'll post here.

Again, thx a lot for helping me. You're great!



Re: dimensions.AddDistanceBetweenObjects


 ThisDV.ViewToSheet(vx, vy, x1, y1)..

What does mean vx, vy, x1, y1 variable for argument.

As per my understanding

vx,vy - view range

x1,y1 - sheet range

Please correct me...

Re: dimensions.AddDistanceBetweenObjects

Hi Marcio_Lima,

I have facing same issue...can you please help me...

I want to create dimension - horizontal and vertical but it is not link with view..

Please guide..if it is possible to share code here...

Thanks in Advanced