Jump to content

Recommended Posts

Posted

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,

Posted

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.

  • 2 weeks later...
Posted

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,

  • 2 months later...
Posted

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.

Posted

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):

 

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)
)
;;

 

This is AIX_Dim.lsp that dimesnion .. what I change here is just that i scale up depending on scale with: (setvar "dimscale" 1)

 

(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

Posted
Not sure if this is what you are after.
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.

Posted
have a look at mr. terry's dm.lsp
Thank you, good sir, for that link.

 

DM.lsp actually modifies the selected dimension entities rather than their DimStyle (the table object) but the concept of this code can be applied as needed.

  • 13 years later...
Posted

Hello Sir,

 

I need this lisp for My project Dimension match DM.

 

Ragards

Posted

Select a Dimension  then Shift+Right-Click → Select Dim Style → pick an option.

image.thumb.png.b6391405d943b85bbf7caf5178195d0f.png

  • Agree 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...