Jump to content

How do I set the dimension style on AutoLisp?


brianhiroshi

Recommended Posts

Hi, I'm trying to make the dimensions of the draw I created on the Lisp but I don't know how to change its properties. Does someone know how to do it?

I'm having another problem too, the command "dimangular" only makes the dimensions if the drawing is properly zoomed, not too close neither too far, otherwise it doesn't accepts the pickpoints I had set. Is ther anyway too solve this problem without having to zoom it manually?

Thanks

Link to comment
Share on other sites

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    11

  • brianhiroshi

    11

  • Se7en

    4

  • alanjt

    2

As for the dimangular problem, I would have thought that as long as the points lie on the curve in question, it should be no problem with zooming in or not :?

Link to comment
Share on other sites

I've tried dimstyle but I just don't know how to use it in Lisp. Should I create the style and only then load it with dimstyle?

Thanks!

Link to comment
Share on other sites

I suppose you could check its existence using:

 

(if (tblsearch "DIMSTYLE" "[b][i]stylename[/i][/b]")
   (command "-dimstyle" "restore" "[b][i]stylename[/i][/b]")
   (princ "\n<!> Dimstyle not found <!>"))

 

does this help at all?

 

Lee

Link to comment
Share on other sites

Actually I was looking for something like that:

 

(defun layer_set (lyr col ltname)

(if (tblsearch "LAYER" lyr)

(command ".Layer" "_Thaw" lyr "_UnLock" lyr "_On" lyr "_Set" lyr "")

(if (tblsearch "LTYPE" ltname)

(command "._Layer" "_Make" lyr "_Color" col lyr "_LT" ltname lyr "")

(command "._Layer" "_Make" lyr "_Color" col lyr "_LT" "Continuous" lyr "")

)

)

)

 

That is what I found for layers, if the layer exists it will use it, if not, it will create the layer with the desired features, but I wanted something like that for the dimensionstyle. The problem is that I don't know how to call this features neither if what I want to do is possible... I'm sorry, my english is not that good but I hope you've understood what I'm looking for.

 

Thanks!

Link to comment
Share on other sites

I suppose to make the new dimstyle you would have to set all the necessary dimension variables how you would like them, and then save it as a new dimension style - but I have never personally done it myself, so I am only guessing. :P

 

A list of dimension variables can be found here:

 

http://www.74mph.com/faq/FAQ00066.html

 

or here

http://www.hyperpics.com/system_variables/

Link to comment
Share on other sites

  • 2 weeks later...

Hi again, I believe I've found the variables that I'll have to use to set the dimension style, but I still can't find which is the command or function that I need to create the new dimension style. Would you have any idea of how to do it?

Thanks

Link to comment
Share on other sites

I use a simple conditional like this:

;; give the dimestyle a name.
(if (tblsearch "DIMSTYLE" "<YOUR DIMSTYLE NAME>")
 (command "-dimstyle" "r" "<YOUR DIMSTYLE NAME>")
 (progn
   (mapcar 'eval
           '(
             (SETVAR "DIMADEC" 0) (SETVAR "DIMALT" 0) (SETVAR "DIMALTD" 2)
             (SETVAR "DIMALTF" 25.4) (SETVAR "DIMALTRND" 0.0) (SETVAR "DIMALTTD" 2)
             ;
             ; ...<snip> All your variables.
             ;
             (SETVAR "DIMTXT" 0.03125) (SETVAR "DIMTZIN" 0) (SETVAR "DIMUPT" 0)
             (SETVAR "DIMZIN" 
             )
           )
   (command "-dimstyle" "s" "<YOUR DIMSTYLE NAME>")
   )
 )
 

Link to comment
Share on other sites

i have our dimensions set in our template, but since drawings can be purged, in the startup, i insert all dimensions, etc. through objectdbx. i was wondering, if you make a change to a dimension style in one file, is it possible to bring that into another file and overwrite the existing dimension style (even if it's active), like you would 'redefine' a block?

is my only option to redefine the variables i've changed through the setvars?

Link to comment
Share on other sites

> ODBX Redefine?

Not sure. I will have to set up a test to see, but i assume it would work (redefine).

 

BTW im sure you would have to set the dimstyle to something else and then redefine it.

Link to comment
Share on other sites

It doesn't look like `it' will get redefined.

I set up a test and copied from one drawing to the current via ODBX and nothing changed.

 

Sorry, looks like your going to have to set variables. :)~

Link to comment
Share on other sites

It doesn't look like `it' will get redefined.

I set up a test and copied from one drawing to the current via ODBX and nothing changed.

 

Sorry, looks like your going to have to set variables. :)~

 

what i figured. i guess i could rename the dimension style, import the updated style, change all objects that use the old style to the 'new' one and delete the old style.

 

probably easier/safer to just set the variables.

 

thanks John.

Link to comment
Share on other sites

what i figured. i guess i could rename the dimension style, import the updated style, change all objects that use the old style to the 'new' one and delete the old style.

 

probably easier/safer to just set the variables.

 

thanks John.

 

Yep its a lot easier. Just modify that conditional above to ensure that you always have the proper settings.

 

Try something like:

 

( (lambda ( / _dimstyle-setup )
   (defun _dimstyle-setup ( / )
     (mapcar 'eval
             '(
               (SETVAR "DIMADEC" 0) (SETVAR "DIMALT" 0) (SETVAR "DIMALTD" 2)
               (SETVAR "DIMALTF" 25.4) (SETVAR "DIMALTRND" 0.0) (SETVAR "DIMALTTD" 2)
               ;
               ; ...<snip> All your variables.
               ;
               (SETVAR "DIMTXT" 0.03125) (SETVAR "DIMTZIN" 0) (SETVAR "DIMUPT" 0)
               (SETVAR "DIMZIN" 
               )
             )
     )

   (if (tblsearch "DIMSTYLE" "<YOUR DIMSTYLE NAME>")
     (progn
       ;; if the dimstyle exists
       ;; make sure its setup properly
       (_dimstyle-setup)
       ;; set it current
       (command "-dimstyle" "r" "<YOUR DIMSTYLE NAME>")
       )
     (progn
       ;; otherwise
       ;; set it up properly
       (_dimstyle-setup)
       ;; save it.
       (command "-dimstyle" "s" "<YOUR DIMSTYLE NAME>")
       )
     )
   )
)

Link to comment
Share on other sites

What if I wanted to place a symbol in front of the number of the dimension, for example, instead of having only 100 for the dimension I would like to have

Ф100mm? Is it possible to make a lisp that inserts the symbols or units?

Thanks

Link to comment
Share on other sites

Alter the DIMPOST variable --

 

For example:

 

DIMPOST = mm

Return for 100 = 100mm

 

DIMPOST = mm

Return for 100 = 100mm

 

DIMPOST = mm

Return for 100 = mm100

Link to comment
Share on other sites

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...