Author Topic: How do you get the coordinates of a Dyn. Blocks Parameter grips  (Read 1917 times)

0 Members and 1 Guest are viewing this topic.

BazzaCAD

  • Guest
How do you get the coordinates of a Dyn. Blocks Parameter grips
« on: October 15, 2008, 06:12:00 PM »
Ok I posted a similar topic last year here:
http://www.theswamp.org/index.php?topic=17582.0
But now I'd like to get the coordinates of the grip points\end points of the "Overall Length" Parameter.
Anyone have any ideas on this?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do you get the coordinates of a Dyn. Blocks Parameter grips
« Reply #1 on: October 15, 2008, 07:21:09 PM »
Here's a start but gotta go....maybe someone can get it working correctly :P

Code: [Select]
(defun c:test (/ blks props p d ang ins)
  (if (and (setq blk (vlax-ename->vla-object (car (entsel))))
   (= (vla-get-ObjectName blk) "AcDbBlockReference")
   (setq ins (vlax-get blk 'InsertionPoint))
   (setq props (vlax-invoke blk 'getdynamicblockproperties))
      )
    (foreach p props
      (if (= (vla-get-propertyname p) "Overall Length")
(setq d (/ (vlax-variant-value (vla-get-value p)) 2.))
      )
      (if (= (vla-get-propertyname p) "Angle1")
(setq ang (vlax-variant-value (vla-get-value p)))
      )
    )
  )
  (list (polar ins ang d) (polar ins (+ pi ang) d))
)
« Last Edit: October 15, 2008, 08:49:00 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BazzaCAD

  • Guest
Re: How do you get the coordinates of a Dyn. Blocks Parameter grips
« Reply #2 on: October 15, 2008, 07:47:15 PM »
Hmmmm, that was easier then I thought, thanks a lot.
It seams to be working correctly...
What am I missing?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do you get the coordinates of a Dyn. Blocks Parameter grips
« Reply #3 on: October 15, 2008, 08:41:32 PM »
Hmmmm, that was easier then I thought, thanks a lot.
It seams to be working correctly...
What am I missing?


Maybe it does work :) and you're welcome.
« Last Edit: October 15, 2008, 08:46:35 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do you get the coordinates of a Dyn. Blocks Parameter grips
« Reply #4 on: October 15, 2008, 09:10:30 PM »
Here's another version  :-):

Code: [Select]
(defun c:test (/ blks props p d ang ins)
  (if (and (setq blk (vlax-ename->vla-object (car (entsel))))
   (= (vla-get-ObjectName blk) "AcDbBlockReference")
   (setq ins (vlax-get blk 'InsertionPoint))
   (setq props (vlax-invoke blk 'getdynamicblockproperties))
      )
    (foreach p (mapcar 'cons
       (mapcar 'vla-get-propertyname props)
       (mapcar 'vlax-variant-value
       (mapcar 'vla-get-value props)
       )
       )
      (if (= (car p) "Overall Length")
(setq d (/ (cdr p) 2.))
      )
      (if (= (car p) "Angle1")
(setq ang (cdr p))
      )
    )
  )
  (list (polar ins ang d) (polar ins (+ pi ang) d))
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC