Author Topic: Dimension Manager lisp  (Read 4382 times)

0 Members and 1 Guest are viewing this topic.

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #15 on: October 26, 2021, 04:51:27 PM »
oops posted the wrong thing.

Code: [Select]
(if (eq (getvar 'dimstyle) "TOPO")
  (setvar "celtscale" (* scl 0.00025))
  (setvar "celtscale" 1)
)


PM

  • Guest
Re: Dimension Manager lisp
« Reply #16 on: October 26, 2021, 07:14:59 PM »
Thanks mhupp  :smitten: :smitten:

PM

  • Guest
Re: Dimension Manager lisp
« Reply #17 on: December 04, 2021, 04:57:39 AM »
I use this code to change the scale of the dimensions.

I want to add an update to this code and if the dimension style have the name TOPO to change the linetype scale to "celtscale" (* scl 0.00025) unless  the "celtscale" 1. I try to add

Code - Auto/Visual Lisp: [Select]
  1. (if (eq (getvar 'dimstyle) "TOPO")
  2.   (setvar "celtscale" (* scl 0.00025))
  3.   (setvar "celtscale" 1)
  4. )

in the code but is not change the linetype scale. Can any one help me?

Thanks


Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:dimfixscl (/ scl th ars tof ss)  ;was missing scl, n nolonger needed
  3.   (vl-load-com) ;needed for vla or vlax functions
  4.   (initget 7)
  5.   (setq scl (getint "\n Select Scale (50,100,200,250,500,etc) :"))
  6.   (setq th (* scl 0.00175))
  7.   (setq ars (* scl 0.002))
  8.   (setq tof (* scl 0.001))
  9. )
  10.   (if (and (setq ss (ssget '((0 . "DIMENSION")))) (> scl 0)) ;checks if you inputted a number greater than 0 for scale
  11.     (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
  12.       (vla-put-TextHeight (vlax-ename->vla-object dim) th)
  13.       (vlax-put-property (vlax-ename->vla-object dim) 'ArrowheadSize ars)
  14.       (vla-put-TextGap (vlax-ename->vla-object dim) tof)
  15.     )  ; foreach
  16.   )    ; if
  17. )      ; defun
  18.  
  19.  

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #18 on: December 04, 2021, 07:20:32 AM »
This should get it working.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimfixscl (/ scl th ars tof ss)  ;was missing scl, n nolonger needed
  2.   (vl-load-com)  ;needed for vla or vlax functions
  3.   (initget 7)
  4.   (setq scl (getint "\n Select Scale (50,100,200,250,500,etc) :")
  5.         th (* scl 0.00175) ars (* scl 0.002) tof (* scl 0.001)
  6.   )
  7.   (if (setq ss (ssget '((0 . "DIMENSION"))))
  8.     (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
  9.       (setq dim (vlax-ename->vla-object dim))
  10.       (vla-put-TextHeight dim th)
  11.       (vlax-put-property dim 'ArrowheadSize ars)
  12.       (vla-put-TextGap dim tof)
  13.       (if (= (vlax-get-property dim 'StyleName) "TOPO")
  14.         (vla-put-linetypescale dim (* scl 0.00025))
  15.         (vla-put-linetypescale dim 1)
  16.       )
  17.     )
  18.   )
  19.   (princ)
  20. )
« Last Edit: December 04, 2021, 12:14:13 PM by mhupp »

PM

  • Guest
Re: Dimension Manager lisp
« Reply #19 on: December 04, 2021, 09:59:31 AM »
Hi mhupp . I try your code but not change the linetype scale.
 Lookk the dwg file with the dimension styles and the test i did.

Thanks

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #20 on: December 04, 2021, 12:15:15 PM »
Sorry I didn't understand what you wanted. The code is updated and will do what you want now.

PM

  • Guest
Re: Dimension Manager lisp
« Reply #21 on: December 04, 2021, 01:03:21 PM »
Thanks mhupp   now works fine  :smitten: :smitten: