PDA

View Full Version : How to check to see if a dimstyle has already been created?



GreyHippo
2004-11-04, 06:04 PM
I am writing a routine that will setup dimension styles based on plotting scale. For example the dimstyles will be named WHATEVER 20 (for a dwg that is 1"=20') or WHATEVER 48 (for a dwg that is 1/4"=1'-0").

To get the routine to work I placed a "y" after I initiated the dimstyle command (so it would say yes to overwrite is it already exists)

Is there another way around this.

msretenovic
2004-11-04, 06:48 PM
This will return a list of all dimstyles in the drawing ;) :


(defun getDims
(
/
dim ;dimstyle
dimCol ;dimension collection
dwg ;current drawing
return ;list to be returned
)
(vl-load-com)
(setq dwg (vla-get-activeDocument (vlax-get-acad-object))
dimCol (vla-get-dimStyles dwg)
return ()
)
(vlax-for dim dimCol
(setq return (append return (list (vla-get-name dim))))
)
return
)


Have a good one :beer:

kennet.sjoberg
2004-11-04, 09:27 PM
(if (not (tblsearch "DIMSTYLE" "WHATEVER 20" ) )
(princ "Her do I Make the missing dimstyle" )
(princ "Her do I do nothing, the dimstyle is already there" )
)

: ) Happy Computing !

kennet