Can Dimensions be "stretched" via VBA

Can Dimensions be "stretched" via VBA

Anonymous
Not applicable
524 Views
6 Replies
Message 1 of 7

Can Dimensions be "stretched" via VBA

Anonymous
Not applicable
I needing to move an object at the same time I want the dimension to stretch with it. I placed the object via code and the dimension. I have not be able to figure out how to associate dimensions via VBA so when I go to move the object I place a crossing window and then use:

For Each objSelection In objss
objSelection.Move vOldPT, HandleLocPT
objSelection.Update
Next

My selection set has DIMENSIONS but with this I move the dimension not stretch. When I try to use the DXF codes for my selectionset filter I get a fatal error about "The object invoked has disconnected from its clients." then all shuts down.

How can I stretch a dimension via VBA code or Can I?
0 Likes
525 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
hi,

You might want to look into the DIMASSOC variable. Setting it at 2 will do what you want i think

e.g. ThisDrawing.SetVariable "DIMASSOC", 2
0 Likes
Message 3 of 7

Anonymous
Not applicable
DIMASSOC is set to 2.
I think it has to do when you dimension manually you snap to a "insertion point" or "end of line" but in my code I just go thru and place the dimension points to a calculated distance. I'm not sure how to "snap" to existing objects
0 Likes
Message 4 of 7

Anonymous
Not applicable
you might want to check setting the osnap(?) variable then, i don't have much experience with programming dimensions but i don't think stretching them would be necessary
0 Likes
Message 5 of 7

Anonymous
Not applicable
then how would I use a osnap when placing a dimension by the ThisDrawing.ModelSpace.AddDimRotated(pt1, pt2, pt3, dimrotation)

I thought about a selection set by point but then its looking for a 3 dimensional double. Then I thought about a sendcommand where I could dimreassociate the dimension but I'm trying to keep user intervention out. Thanks for the thought
0 Likes
Message 6 of 7

Anonymous
Not applicable
I've noticed with lisp programs that the osnap variable can effect the automatic placement of say a circle at a given point, never tried it or noticed if it did the same with vba, thought maybe it might... So if i'm understanding the dimensions are placed by the program somewhat near existing objects and they may not be dimensioned exactly? If that's the case maybe determining the exact intersection or dimension that you wish to dimension would help. Edited by: cadger on Jan 9, 2009 5:57 AM
0 Likes
Message 7 of 7

Anonymous
Not applicable
What I'm doing is this
I have a form that the user fills out that creates a "handle" scheme. I then place these handles as blocks based a calculated values. There is an option for the user to add dimensions. If this option is selected then right after placing the blocks I go back and placed dimensions using the same calculated values for points. If I could get the dimension associated with the blocks then "stretching" the dimensions would not be necessary but I've had no luck in that avenue. I have found discussions where some have used lisp thru VBA to get to the ExtLIne1Point and ExtLine2Point but when I try to create a visual lisp object I'm getting errors!!!!!!
0 Likes