Author Topic: Move dimension to picked points  (Read 1480 times)

0 Members and 1 Guest are viewing this topic.

rkmcswain

  • Swamp Rat
  • Posts: 978
Move dimension to picked points
« on: July 25, 2023, 08:16:11 AM »
Good day all.  It's been a while since I was in lisp all day, and I feel like I'm missing something simple here.
I have a dimension as shown, where the dimension was added to the bottom line of the rectangle (no extension lines here)


Note that the dimension has been dragged away from the rectangle. All I want to do is move the dimension back so that it sits exactly on the originally picked points (on the rectangle) - which should be DXF codes 13 and 14, but I  can't get entmod to work.
This is what the final result should be (the bottom line of the rectangle is under the dimension line)


TIA

Tharwat

  • Swamp Rat
  • Posts: 712
  • Hypersensitive
Re: Move dimension to picked points
« Reply #1 on: July 25, 2023, 01:14:56 PM »
Hi,
I believe entmoding the DXF 10 with 13 or 14 should work which should move the text line to either of the base points.
Here is just a humble instance.
Code - Auto/Visual Lisp: [Select]
  1. (setq elst (entget (car (entsel "\nSelect dimension object : "))))
  2. (entmod (subst (cons 10 (cdr (assoc 13 elst))) (assoc 10 elst) elst))

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Move dimension to picked points
« Reply #2 on: July 25, 2023, 02:40:27 PM »
Thank you @Tharwat - that indeed does work. My syntax was off.  :uglystupid2:


Tharwat

  • Swamp Rat
  • Posts: 712
  • Hypersensitive
Re: Move dimension to picked points
« Reply #3 on: July 25, 2023, 03:17:03 PM »
You're welcome, it happens to best of us. :grinwink:

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Move dimension to picked points
« Reply #4 on: July 25, 2023, 07:42:02 PM »
One thing to note. It worked perfect the first time, but then if I moved the dimension and tried it again, it failed.Every time.
Turns out I was moving it by grip editing the text, selecting "Move with Dim Line", and then stretch moving the dimension lines.It was at this point the code failed to restore the position.
What I found what that when you move the dimension like this, it adds 128 to the group 70 bitcode (which means the text is not in the default location), and if this 128 bit code exists, the code fails.I fixed it by removing the 128 bit code and then not only does the dimension go back to the picked points, it also restores the text to its default location.
 :angel:

Tharwat

  • Swamp Rat
  • Posts: 712
  • Hypersensitive
Re: Move dimension to picked points
« Reply #5 on: July 26, 2023, 05:42:26 AM »
You can entmod back the DXFs 13 and 14 back to text line position DXF 10 then shift the dimension object back to the original position of 13 or 14 based on the desired repositioning.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Move dimension to picked points
« Reply #6 on: August 21, 2023, 08:20:58 AM »
Thanks Tharwat !