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.
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!
Solved! Go to Solution.
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!!
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:
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
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 oDims.AddLength(oDVLine) Next
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?
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!
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...