I was wondering if anyone here has ever had the diameter dimensions on a 2D drawing suddenly, spontaneously change. A couple weeks ago, I created a drawing with some 2D views in model space. I find it a lot easier to dimension parts in model space, than on a layout view.) Anyway, I actually built parts from the 2D views. Then today I re-opened the drawing and found that all my diameter dimensions were changed. There is no problem with linear and ordinate dimensions - just diameter dimensions. For instance, a diameter dimension of .1285 changed to .66258. I can't imagine how this would happen. I can place new diameter dimensions, and they are correct. But why did all the old dimensions change?
Comments
AF-0005 2D.dwg
Here is some code to fix this. The code assumes that the drawing is 2D.
[code](defun c:UpdateDimDia ( / cnt doc ss)
(if (setq ss (ssget '((100 . "AcDbDiametricDimension"))))
(progn
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(if (= (logand (getvar 'undoctl) 8) 8)
(vla-endundomark doc)
)
(vla-startundomark doc)
(setq cnt
(length
(vl-remove
nil
(mapcar
'(lambda (enme / elst)
(setq elst (entget enme))
(if
(and
(equal (cdr (assoc 210 elst)) '(0.0 0.0 1.0) 1e-8)
(not (equal (last (assoc 10 elst)) (last (assoc 15 elst)) 1e-8))
)
(entmod
(subst
(append
(vle-remove-last (assoc 15 elst))
(list (last (assoc 10 elst)))
)
(assoc 15 elst)
elst
)
)
)
)
(vle-selectionset->list ss)
)
)
)
)
(princ (strcat "\n" (itoa cnt) " diameter dimension(s) updated "))
(vla-endundomark doc)
)
)
(princ)
)[/code]
For additional options to load Lisp files see: http://www.b-k-g.nl/loading-lisp-programs.html
The fact that the dimensions are non-associative is not surprising (see my explanation in post #5). But the elevated position of one of the definition points of course is. I can't think of a scenario, short of user input, that would cause this.
I want to thank you for the LISP code. I just tried it, and it worked great. Could you outline for me, how it goes about doing it's work?
I'm still not clear on how all of my diameter dimensions suddenly changed. You said the dimensions are "non associative" because they are in blocks. Is dimensioning features in blocks problematic? I've always dimensioned features in blocks, whether created by the _VIEWBASE or _BLOCK commands. This was the first time I have ever known all the diameter dimensions to spontaneously change.
You said "The problem is caused by one of the definition points of the diameter dimension having an elevated position..". But I have multiple 2D blocks in my drawing, and the errors were found in all of them. Do you think I should use the "FLATTEN" on my 2D objects before I create the blocks? Would that correct the elevation issues? (I would try this, but unfortunately, I didn't save a copy of the damaged drawing before I applied your LISP application.)
Example scenario:
1. Start a new drawing.
2. Set the ELEVATION to 1000.
3. Create a circle with R=2000.
4. Create a Diametric Dimension for this circle (dim=4000).
5. Use the FLATTEN command and select all entities.
6. BC reports: 'Dimension disassociated'.
7. The Diametric Dimension now reads 4123.
8. The entity list of the dimension shows that 3 points have been flattened, but one definition point was skipped.
So the advice must be: Use the FLATTEN command BEFORE creating any dimensions.
I have noticed that the elements in your blocks sometimes have a minute Z-coordinate (in 1e-15 range). This is the result of rounding errors in the BricsCAD procedure that was used to create these blocks. You can find similar errors in BIM sections. I understand rounding errors, but it is still strange that a block that is supposed to be completely flat contains entities with non-zero Z-coordinates.
Short explanation of the Lisp code:
The code checks all Diametric Dimensions in the drawing. For each dimension it compares the elevation of two definition points and corrects the elevation of one point if they deviate. The code will skip dimensions that were not create in the WCS.
Yes, my scenario points to two issues.
1.
All (or most?) dimensions that are flattened lose their associativity.
2.
Diametric Dimension dimensions are only partly flattened resulting in 'buggy' values.