Author Topic: Dimension Manager lisp  (Read 4243 times)

0 Members and 1 Guest are viewing this topic.

PM

  • Guest
Dimension Manager lisp
« on: October 24, 2021, 03:52:02 AM »
Hi. I have a problem with dimensions. I am searching for a lisp to change Arrow size, Text size and text offset from selected dimensions based on drawing scale. I attach brawing with the dimension sizes for scales (1:50,1:100,1:200,1:250,1:500,1:1000,1:5000 in meters).

with my calculations  Arrow size = scale x 0.002
                                 Text size = scale x 0,00175
                                 text offset = scale x 0.001


Can any one help  ?

Thanks

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Dimension Manager lisp
« Reply #1 on: October 24, 2021, 08:48:41 AM »
You do know with Annotative Dimensions all of that is done automatically?
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

PM

  • Guest
Re: Dimension Manager lisp
« Reply #2 on: October 24, 2021, 08:54:30 AM »
I stop using annotation dimensions,text and block because i have problems with this drawings. When i give them to others the say to me that they can not save the drawings . The problem solved when i stop using annotations. That's why i need this lisp.

Thanks

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Dimension Manager lisp
« Reply #3 on: October 24, 2021, 08:06:21 PM »
Run Dumpit.lsp on a dim and it will show you all the properties you can get at, for a DIM its big.

;   ArrowheadSize = 3.0
;   TextHeight = 2.5

(vla-put-ArrowheadSize obj 5)
A man who never made a mistake never made anything

PM

  • Guest
Re: Dimension Manager lisp
« Reply #4 on: October 25, 2021, 06:45:12 AM »
I try this but is not working !!!! I have to click 2 times the same dimension to change text and arrow size. The text Gap not working. I want to select multiple dimension and do the changes. Any ideas?

Code - Auto/Visual Lisp: [Select]
  1. (defun C:test (/ ss n th ars tof);
  2.  (setq scl (getint "\n select scale (50,100,200,250,500,etc) :"))
  3.  (setq th (* scl 0.00175))
  4.  (setq ars (* scl 0.002))
  5.  (setq tof (* scl 0.001))
  6.   (if (setq ss (ssget '((0 . "DIMENSION"))))
  7.     (repeat (setq n (sslength ss))
  8.       (vla-put-TextHeight (vlax-ename->vla-object (ssname ss (setq n (1- n)))) th)
  9.       (vlax-put-property (vlax-ename->vla-object (car (entsel))) 'ArrowheadSize ars)
  10.       (vla-put-TextGap obj tof)
  11.     ); repeat
  12.   ); if
  13. ); defun
  14.  
  15.  



Can any one help ?

Thanks
« Last Edit: October 25, 2021, 07:11:02 AM by PM »

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: Dimension Manager lisp
« Reply #5 on: October 25, 2021, 07:39:57 AM »
You haven't declared obj variable with VLA-OBJECT argument - it should break at that line - last one (IMHO)...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #6 on: October 25, 2021, 09:38:26 AM »
The reason you have to double select to change arrow size is your using (car (entsel)) in the vlax-put rather then ssname.
This would also fix the text gap like ribarm said obj is undeclared.
Code: [Select]
(vla-put-TextHeight (vlax-ename->vla-object (ssname ss (setq n (1- n)))) th)
(vlax-put-property (vlax-ename->vla-object (ssname ss n)) 'ArrowheadSize ars)
(vla-put-TextGap (vlax-ename->vla-object (ssname ss n)) tof)




I use foreach instead so you don't have to keep calculating the n # updating to either will get what you want.
Code: [Select]
(defun C:test (/ scl th ars tof ss)  ;was missing scl, n nolonger needed
  (vl-load-com) ;needed for vla or vlax functions
  (initget 7)
  (setq scl (getint "\n Select Scale (50,100,200,250,500,etc) :"))
  (setq th (* scl 0.00175))
  (setq ars (* scl 0.002))
  (setq tof (* scl 0.001))
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
      (vla-put-TextHeight (vlax-ename->vla-object dim) th)
      (vla-put-ArrowheadSize (vlax-ename->vla-object dim) ars)
      (vla-put-TextGap (vlax-ename->vla-object dim) tof)
    )  ; foreach
  )    ; if
)      ; defun
« Last Edit: October 26, 2021, 04:39:52 PM by mhupp »

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: Dimension Manager lisp
« Reply #7 on: October 25, 2021, 10:20:30 AM »
No need for check (> scl 0)... (initget) is enough...

Code: [Select]
(initget 7)
(setq scl (getint "\n Select Scale (50,100,200,250,500,etc) :"))

 :wink:
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

PM

  • Guest
Re: Dimension Manager lisp
« Reply #8 on: October 25, 2021, 11:30:07 AM »
This code work fine. Thanks you all  :smitten: :smitten:

I want to ask samething similar to this. Is any command like DIMGAP (set  the TextGap) ,for TextHeight and ArrowheadSize?

Thanks

PM

  • Guest
Re: Dimension Manager lisp
« Reply #9 on: October 25, 2021, 11:36:39 AM »
iI find

DIMGAP (TextGap)
DIMTXT (TextHeight)
DIMASZ (ArrowheadSize)

Thanks

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #10 on: October 25, 2021, 03:01:47 PM »
DIMGAP (TextGap)
DIMTXT (TextHeight)
DIMASZ (ArrowheadSize)

(setvar 'DIMGAP 5)

Those are variables changing them won't change any existing dimensions. only when you create a new dimension the new variables/sizes.
you would then have to use another command to update the dimensions with the new variables. i guess you could skip all the vla-put's

Code: [Select]
(defun C:test (/ scl th ars tof ss)  ;was missing scl, n nolonger needed
  (vl-load-com) ;needed for vla or vlax functions
  (setq scl (getint "\n Select Scale (50,100,200,250,500,etc) :"))
  (setvar 'DIMTXT (* scl 0.00175))
  (setvar 'DIMASZ (* scl 0.002))
  (setvar 'DIMGAP (* scl 0.001))
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (command "DIM1" "UPDATE" SS "")
  )
)




« Last Edit: October 25, 2021, 03:08:56 PM by mhupp »

PM

  • Guest
Re: Dimension Manager lisp
« Reply #11 on: October 26, 2021, 02:14:54 AM »
Yes mhupp iknow. I use them to set the simension style before use it .

PM

  • Guest
Re: Dimension Manager lisp
« Reply #12 on: October 26, 2021, 08:02:10 AM »
I want to add a check fillter from linetype scale .

If dimstyle is TOPO then line type   (setvar "celtscale" (* scl 0.00025)) else  (setvar "celtscale" 1)

Can any one help?

Thanks

mhupp

  • Bull Frog
  • Posts: 250
Re: Dimension Manager lisp
« Reply #13 on: October 26, 2021, 04:28:05 PM »
If dimstyle is TOPO then line type   (setvar "celtscale" (* scl 0.00025)) else  (setvar "celtscale" 1)

(or (setvar "celtscale" (* scl 0.00025)) (setvar "celtscale" 1))
If scl isn't defined it will set celtscale to 1
« Last Edit: October 26, 2021, 04:50:57 PM by mhupp »

PM

  • Guest
Re: Dimension Manager lisp
« Reply #14 on: October 26, 2021, 04:34:14 PM »
I can not see any ware the dimstyle TOPO