Author Topic: Coordinates arrorheads dimensios  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
Coordinates arrorheads dimensios
« on: July 06, 2016, 01:14:21 PM »
I need to get the coordinates of the arrows of an entity DIMENSION.
I found the DXF codes 10-11-13 and 14, but only 10 corresponds to one of the arrows.
How can I obtain the coordinates of the other arrow?

ribarm

  • Gator
  • Posts: 3304
  • Marko Ribar, architect
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Coordinates arrorheads dimensios
« Reply #2 on: July 06, 2016, 02:22:03 PM »
On an AcDbAlignedDimension, 13 & 14 seem to be the DXF codes you need.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Coordinates arrorheads dimensios
« Reply #3 on: July 06, 2016, 03:21:49 PM »
The point your wanting to obtain is not stored in the entity and must be calculated. This is different depending on the type of dimension.

for linear or aligned dimensions - try the following:

Code: [Select]
(defun C:test (/ pjk-Massoc el dpt ali dis ep1 ep2 dan pt1 pt2 pt)

   (defun pjk-Massoc (el dxf)
      (vl-remove-if 'null
         (mapcar (function (lambda (x)(if (= (car x) dxf) x nil))) el)
      )
   )

   (setq el  (entget (car (entsel "\nSelect A Linear/Aligned Dimension: ")))
         dpt (cdr (assoc 10 el))
         ali (member "AcDbRotatedDimension" (mapcar 'cdr (pjk-Massoc el 100)))
         dis (cdr (assoc 42 el))
         ep1 (cdr (assoc 13 el))
         ep2 (cdr (assoc 14 el))
         dan (if ali (cdr (assoc 50 el)) (angle ep1 ep2))
         pt1 (inters
                dpt
                (polar dpt dan dis)
                ep1
                (polar ep1 (+ dan (/ pi 2)) dis)
                nil
             )
         pt2 (inters
                dpt
                (polar dpt dan dis)
                ep2
                (polar ep2 (+ dan (/ pi 2)) dis)
                nil
             )
         pt  (trans (if (= pt1 dpt) pt2 pt1) 0 1)
   )
   (command "._line" "_non" pt)
)
« Last Edit: July 06, 2016, 03:28:41 PM by PKENEWELL »
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Coordinates arrorheads dimensios
« Reply #4 on: July 06, 2016, 03:31:15 PM »
I have corrected my code in the previous post. I had the aligned vs. rotated dimension code backwards. i.e. "rotated" dimensions always have an "aligned" code 100, but "aligned" dimensions do not have a "rotated" code 100 in them. Sorry for the mistake.  :uglystupid2:
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

Lupo76

  • Bull Frog
  • Posts: 343
Re: Coordinates arrorheads dimensios
« Reply #5 on: July 07, 2016, 02:23:12 AM »
I have corrected my code in the previous post. I had the aligned vs. rotated dimension code backwards. i.e. "rotated" dimensions always have an "aligned" code 100, but "aligned" dimensions do not have a "rotated" code 100 in them. Sorry for the mistake.  :uglystupid2:

Perfect!
it is just what I wanted!
Thank you.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Coordinates arrorheads dimensios
« Reply #6 on: July 07, 2016, 11:56:17 AM »
Perfect!
it is just what I wanted!
Thank you.

No problem. Glad I was able to help!  :-)
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt