what if it has over rides, are you wanting to update the style to include the over rides? And are you trying to update an existing style to match what you pick? It seems that if you can pick a dimension, the style already exists in that drawing.



Registered forum members do not see this ad.
Picking dimension to set dimstyle properties, AutoCAD 2009.
Has anyone made a program to match dimstyle
properties to a picked dimension.
Something that would allow the user to pick a
dimension object and have all the dimstyle properties
match that dimension?
Using either VBA or Lisp.
Thank you,
what if it has over rides, are you wanting to update the style to include the over rides? And are you trying to update an existing style to match what you pick? It seems that if you can pick a dimension, the style already exists in that drawing.
Everyone has a Photographic memory, some just don't have film



Ok, Yes match the text style but I am more interested in dim text height, arrow head size, dim offsets etc. That would keep a person manually reseting variables to get matching dim settings.
Thank you,
I've also been looking for a routine to match dimension variables from one dimstyle to another (where I work, drawings are done the 'traditional' way with one DimStyle per scale; many drawings have several different scale models and a bunch of dimension styles to go with them, which almost always look different).
I have not been able to find this online, so I might just write the LISP myself. The idea would be to obtain the values of each of the variables for the original DimStyle using entget and assoc and then entmod each of the variables of the target DimStyle (except Dimscale) accordingly, matching the group codes probably with an "if" function. I'll post it if/when I get it done. It's probably a rather simple function, I just haven't gotten around to it yet.
I also need a Dimension Style merge utility (like txtmrg), but that's a different topic and probably beyond my programming abilities.
Not sure if this is what you are after.


With the help of guys here I made a lisp that doesnt need any DimStyles:
I call it AIX_DIMVariabler.lsp where all variables I want are saved.
then I call Variables in different dimstyles I want to access by the menu.
This is AIX_DimVariabler.lsp You can erase (if ... style lines cause I search for a style that should be in dimstyles.
I search the AIX_ISO and then if its not there I load it via C:AIXTXT ...
You can if you want even erase this line
(setvar "dimtxsty" "AIX_ISO")
or set it to Standard or whatever...
(variables):
This is AIX_Dim.lsp that dimesnion .. what I change here is just that i scale up depending on scale with: (setvar "dimscale" 1)Code:defun dim_variabler () (if (not (tblsearch "style" "AIX_ISO")) (C:AIXTXT) ) (setvar "dimadec" 0) (setvar "dimalttz" 0) (setvar "dimcen" 4.0) (setvar "dimdec" 0) (setvar "dimtix" 0) (setvar "dimatfit" 3) (setvar "dimtmove" 2) (setvar "dimdli" 3) (setvar "dimdsep" ",") (setvar "dimdle" 2.0) (setvar "dimexe" 2.0) (setvar "dimexo" 3.0) (setvar "dimlfac" 1) (command "dimtxt" 3.0) (command "dimtih" "off") (command "dimtoh" "off") (setvar "dimtxsty" "AIX_ISO") ) (defun LinjerDim () (setvar "dimgap" 1) (setvar "dimjust" 0) (command "dimsd1" "off") (command "dimse1" "off") (setvar "dimtad" 1) (setvar "dimasz" 3) ;;; (setvar "dimanno" 1) ;annotative måttsättning (setvar "dimblk" "Oblique") (setvar "dimblk1" "Oblique") (setvar "dimblk2" "Oblique") ;(setvar "dimclrd" 4) (setvar "dimclrt" 1) (setvar "dimdle" 2) ) (defun PilDim () (setvar "dimgap" 1) ;;; (setvar "dimanno" 1) ;annotative måttsättning (setvar "dimjust" 2) (setvar "dimtad" 2) (setvar "dimasz" 3) (setvar "dimblk1" "None") (setvar "dimblk2" "Open90") (setvar "dimldrblk" "None") (setvar "dimclrt" 1) ;(setvar "dimclrd" 1) (command "dimsah" "ON") (command "dimsd1" "ON") (command "dimsd2" "OFF") (command "dimsoxd" "OFF") (command "dimse1" "ON") (command "dimse2" "OFF") (setvar "dimdle" 0) ) ;;;)
Code:(defun C:AIX:DIM1 (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------D2-------A")) (command "-layer" "M" "A-------D2-------A" "C" "cyan" "A-------D2-------A" "") (setvar "clayer" "A-------D2-------A") ) ; end if (load "K:\\CAD\\AIX-meny-2008\\Lisp\\Dim\\AIX_DimVariabler.lsp") (Dim_Variabler) (LinjerDim) (setvar "dimscale" 1) (setq p1 (getpoint "\nVälj Första Punkten: ")) (setq p2 (getpoint p1 "\nVälj andra Punkten: ")) (setq p3 (getpoint p2 "\nAnge Placering: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (setvar "clayer" oldlay) (princ) ); end ;;; Detalj_Måttsättning 1:5 (defun C:AIX:DIM5 (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------D2-------B")) (command "-layer" "M" "A-------D2-------B" "C" "cyan" "A-------D2-------B" "") (setvar "clayer" "A-------D2-------B") ) ; end if (load "K:\\CAD\\AIX-meny-2008\\Lisp\\Dim\\AIX_DimVariabler.lsp") (Dim_Variabler) (LinjerDim) (setvar "dimscale" 5) (setq p1 (getpoint "\nVälj Första Punkten: ")) (setq p2 (getpoint p1 "\nVälj andra Punkten: ")) (setq p3 (getpoint p2 "\nAnge Placering: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (setvar "clayer" oldlay) (princ) ); end ;;; Detalj_Måttsättning 1:10 (defun C:AIX:DIM10 (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------D2-------C")) (command "-layer" "M" "A-------D2-------C" "C" "cyan" "A-------D2-------C" "") (setvar "clayer" "A-------D2-------C") ) ; end if (load "K:\\CAD\\AIX-meny-2008\\Lisp\\Dim\\AIX_DimVariabler.lsp") (Dim_Variabler) (LinjerDim) (setvar "dimscale" 10) (setq p1 (getpoint "\nVälj Första Punkten: ")) (setq p2 (getpoint p1 "\nVälj andra Punkten: ")) (setq p3 (getpoint p2 "\nAnge Placering: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (setvar "clayer" oldlay) (princ) ); end ;;; Det_Måttsättning 1:20 (defun C:AIX:DIM20 (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------D2-------D")) (command "-layer" "M" "A-------D2-------D" "C" "cyan" "A-------D2-------D" "") (setvar "clayer" "A-------D2-------D") ) ; end if (load "K:\\CAD\\AIX-meny-2008\\Lisp\\Dim\\AIX_DimVariabler.lsp") (Dim_Variabler) (LinjerDim) (setvar "dimscale" 20) (setq p1 (getpoint "\nVälj Första Punkten: ")) (setq p2 (getpoint p1 "\nVälj andra Punkten: ")) (setq p3 (getpoint p2 "\nAnge Placering: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (setvar "clayer" oldlay) (princ) ); end (defun C:AIX:DIMPIL100 (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------Z1-------F")) (command "-layer" "M" "A-------Z1-------F" "C" "cyan" "A-------Z1-------F" "") (setvar "clayer" "A-------Z1-------F") ) ; end if (load "K:\\CAD\\AIX-meny-2008\\Lisp\\Dim\\AIX_DimVariabler.lsp") (Dim_Variabler) (PilDim) (setvar "dimscale" 100) (setq p1 (getpoint "\nVälj Första Punkten: ")) (setq p2 (getpoint p1 "\nVälj andra Punkten: ")) (setq p3 (getpoint p2 "\nAnge Placering: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (setvar "clayer" oldlay) (princ) ); end
Your routine allows to set the Layer, DimStyle, and Text Style of the selected entity, as current. Not bad, but what we are talking about is (OP correct me if I'm wrong) something like a "Matchprop" function which will take the variable values of the source DimStyle and apply them to a target DimStyle of different scale. Maybe like 'Checkstandards', but simplified.
I'm sure this has already been done, I just haven't found it yet.
Last edited by uddfl; 3rd Feb 2009 at 03:53 pm.
have a look at mr. terry's dm.lsp:
http://web2.airmail.net/terrycad/AutoLISP-Code.htm
Bookmarks