Author Topic: Change Flipstate for Scale X -1  (Read 173 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 601
Change Flipstate for Scale X -1
« on: October 04, 2019, 07:59:26 AM »
Hi all,

What i want to accomplish is a routine that changes my dynamic block to "Flipped" if Scale X is -1.
Thanks for any input or references..



Design is something you should do with both hands. My 2d hand , my 3d hand ..

Dlanor

  • Newt
  • Posts: 170
Re: Change Flipstate for Scale X -1
« Reply #1 on: October 04, 2019, 09:08:31 AM »
Use Lee's dynamic block properties http://www.lee-mac.com/dynamicblockfunctions.html

Lee Mac

  • Seagull
  • Posts: 12267
  • London, England
Re: Change Flipstate for Scale X -1
« Reply #2 on: October 04, 2019, 01:38:48 PM »
Quickly written -
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / f i o s )
  2.     (if (setq s (ssget "_:L" '((0 . "INSERT"))))
  3.         (repeat (setq i (sslength s))
  4.             (setq i (1- i)
  5.                   o (vlax-ename->vla-object (ssname s i))
  6.                   f (if (minusp (vla-get-xeffectivescalefactor o)) 1 0)
  7.             )
  8.             (foreach p (vlax-invoke o 'getdynamicblockproperties)
  9.                 (if (equal '(0 1) (vlax-get p 'allowedvalues)) ;; likely to be a flip parameter
  10.                     (vla-put-value p (vlax-make-variant f vlax-vbinteger))
  11.                 )
  12.             )
  13.         )
  14.     )
  15.     (princ)
  16. )

Could be optimised to target specific blocks or a named dynamic flip parameter.

lamarn

  • Swamp Rat
  • Posts: 601
Re: Change Flipstate for Scale X -1
« Reply #3 on: October 04, 2019, 06:06:15 PM »
That is amazing.
I can write some code but not like that.
Thanks!!
« Last Edit: October 04, 2019, 06:11:41 PM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..