+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Super Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    527

    Default Picking dimension to set dimstyle properties.

    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,

  2. #2
    Senior Member CmdrDuh's Avatar
    Computer Details
    CmdrDuh's Computer Details
    Computer:
    HP workstation xw8200
    RAM:
    2gig, soon to be 4
    Monitor:
    Dual 21s
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Location
    AZ, USA
    Posts
    396

    Default

    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

  3. #3
    Super Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    527

    Default

    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,

  4. #4
    Senior Member uddfl's Avatar
    Using
    AutoCAD 2008
    Join Date
    Oct 2008
    Posts
    312

    Default Bump

    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.

  5. #5
    Super Member CAB's Avatar
    Using
    AutoCAD 2000
    Join Date
    May 2004
    Location
    Tampa, Florida
    Posts
    801

    Default

    Not sure if this is what you are after.
    Attached Files

  6. #6
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Nov 2008
    Posts
    155

    Default

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

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

  7. #7
    Senior Member uddfl's Avatar
    Using
    AutoCAD 2008
    Join Date
    Oct 2008
    Posts
    312

    Default

    Quote Originally Posted by CAB View Post
    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.
    Last edited by uddfl; 3rd Feb 2009 at 03:53 pm.

  8. #8
    Senior Member wizman's Avatar
    Using
    AutoCAD 2009
    Join Date
    Nov 2007
    Location
    Abu Dhabi / Philippines
    Posts
    408

    Default

    have a look at mr. terry's dm.lsp:

    http://web2.airmail.net/terrycad/AutoLISP-Code.htm

  9. #9
    Senior Member uddfl's Avatar
    Using
    AutoCAD 2008
    Join Date
    Oct 2008
    Posts
    312

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by wizman View Post
    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.

Similar Threads

  1. Changing dimension properties
    By rthomas333 in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 20th Aug 2008, 02:26 am
  2. Picking a grip and moving it.
    By CADDict in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 12
    Last Post: 7th Mar 2008, 02:26 am
  3. Picking order
    By cadmench in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 7th Nov 2007, 07:03 pm
  4. Reading Textual Properties of a Linear Dimension via VBA
    By tommyo in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 11th Dec 2006, 08:47 am
  5. Hatch picking
    By willwould in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 27th Dec 2005, 01:12 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts