Hello!
I'm writing function which will help user to offset dimension. After enter command, he select dimension and select point near one of dimension's arrowheads. Then I'm calculating new XLinePoint1 or XLinePoint2 and replacing original.
I have everything done. I thought ... The problem is when user firstly create AlignedDimension and after that he create RotatedDimension by using continous function. After that XLinePoint1 and XLinePoint2 are not parallel to the DimLinePoint (look at image).
Now I really don't have idea how to solve this problem.
Maybe someone know how can I get coordinates of points selected in red rectangles?
I know that one is specified as "dimension line defining point" but what about second? How can I get its coordinates? Or maybe there is other way to get this point?
Thanks.
This would give you the location of the two arrow heads of the rotated and aligned dimensions to the command line .
(defun c:Test (/ d e) (vl-load-com)
;;; Tharwat 15. July. 2012 ;;;
(if (and (setq d (car (entsel "\n Select dimension :"))) (or (equal "AcDbAlignedDimension" (cdr (assoc 100 (reverse (setq e (entget d))))) ) (equal "AcDbRotatedDimension" (cdr (assoc 100 (reverse e))) ) ) ) (vlax-for x (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 e)) ) (if (eq (vla-get-objectname x) "AcDbSolid") (print (vlax-safearray->list (vlax-variant-value (vla-get-coordinate x 3)) ) ) ) ) (princ "\n No selection , or its not a dimension ") ) (princ) )
It might be better to write your request in the correct froum that related to your needs of programming lnguage . and
unfortuneltly I have no idea about C# .
Tharwat
@GrzesiekGP wrote:....
Maybe someone know how can I get coordinates of points selected in red rectangles?
I know that one is specified as "dimension line defining point" but what about second? How can I get its coordinates? Or maybe there is other way to get this point?....
I don't know C# either, but maybe it has something equivalent to entity data and the (inters) and (polar) Lisp functions, which can avoid the need to dig into a Dimension and look for Solids. [The arrowheads will not always be Solids, anyway, or one may be and not the other, depending on arrow settings.]
This is a portion of a routine of mine [used to toggle extension lines on and off], which calculates the location of the other arrowhead ['data' is a variable containing the entity data for the selected Dimension]:
(setq
def1 (cdr (assoc 13 data)); definition point 1
def2 (cdr (assoc 14 data)); definition point 2
ar2 (cdr (assoc 10 data)); arrow-point/end of dimension line at extension line 2
dimdir ; direction of dimension line
(if (= (cdr (assoc 70 data)) 33); aligned Dimension always has (50 . 0.0), so
(angle def1 def2); then - direction between definition points
(cdr (assoc 50 data)); else - direction of dimension line
); end if & dimdir
ar1; other arrow-point/end of dimension line at extension line 1
(inters
ar2
(polar ar2 dimdir 1); in direction of dimension line
def1
(polar def1 (angle def2 ar2) 1); in direction of extension lines
nil
); end inters & ar1
); end setq
@Kent1Cooper wrote:[The arrowheads will not always be Solids, anyway, or one may be and not the other, depending on arrow settings.]
That's correct , and I really did not notice that .
Thanks Kent
@Kent1Cooper wrote:....
This is a portion of a routine of mine [used to toggle extension lines on and off], which calculates the location of the other arrowhead ....
By the way, that's for linear dimensions. Arrowhead locations can be found by other means for angular dimensions, if you need to be able to do that.