Jump to content

Recommended Posts

Posted

hi,all

in autocad2010

for "style",we can easily use the codes below to build a new style.

(if (= (tblsearch "style" "standard") nil)
	(command "style" "standard" "arial" "3.5" "0.666" "0.0" "" "" "")
	(command "style" "standard" "arial" "3.5" "0.666" "0.0" "" "" "")
)

 

it seems the story is not the same for "dimstyle"

 

if I want to build a new "dimstyle" named "standard",what should I do?

 

if the "standard" existed, and I want to modify some option of "standard",what should I do then??

could somebody give me some example codes,please?

thanks for your help.

Posted

hi,after read the thread,I am still confused ,still don't know how to build /modify "dimstyle":(

Posted

give an example on what you want to modify in an existing dimstyle

 

BTW, I edited my first post to include a thread on how to create a dimstyle

Posted

You can make new dimension with this simple command :

 

(vl-cmdf "_.-dimstyle" "_save" "New Dims." )

 

Tharwat

Posted
You can make new dimension with this simple command :

 

(vl-cmdf "_.-dimstyle" "_save" "New Dims." )

 

Tharwat

thank you .

Posted

hi,after some help from you,I finally know how to do it.

here is the codes:

  (defun build_dimstyle(/)
(if (= (tblsearch "dimstyle" "standard") nil)
;then
	(command "dimstyle" "s" "标准")
;else
	(command "dimstyle" "r" "standard")
)
(princ "start setting")
(foreach setuplisp '(
					("dimtxt" . 3.5)
					("DIMADEC" . 2)
					("DIMALTRND" . 0.0000)
					("DIMARCSYM" . 2)
					("DIMASZ" . 2.5000)
					("DIMATFIT" . 3)
					("DIMAUNIT" . 0)						
					("DIMAZIN" . 0)
					
					)
(setvar (car setuplisp) (cdr setuplisp))					
)


(command "-dimstyle" "s" "standard" "yes")

 )

 

 

by the way,

is anyone know how to do this ?

http://www.cadtutor.net/forum/showthread.php?52664-change-the-length-of-tail-of-arrow&p=356629#post356629

Posted

Good work blueshake.

 

And here is another way with the same result if you would like to. And with some corrections as following .

Check this out .

 

(defun build_dimstyle (/)
(if (not (tblsearch "dimstyle" "standard"))
	 (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "??")
	 (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]r" "standard")
        )
(princ "start setting")
(mapcar 'setvar '("dimtxt" "DIMADEC" "DIMALTRND" "DIMARCSYM" "DIMASZ" "DIMATFIT" "DIMAUNIT" "DIMAZIN")
'(3.5 2 0.0000 2 2.5000 3 0 0))
(command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "standard" "[color="red"]_[/color]yes")
 )

 

Besides that, you can use the dimstyle entmake to dimstyle as well and which is a little bit faster .

 

Good luck

 

Tharwat

Posted

Five points for mapcar usage, Tharwat. 8)

 

Although... all of that shows up in the command line. :P lol

Posted
Five points for mapcar usage, Tharwat. 8)

 

Although... all of that shows up in the command line. :P lol

 

I also give five STARS for that comment. :thumbsup:

Posted
(foreach item '(("dimtxt" 3.5)
               ("DIMADEC" 2)
               ("DIMALTRND" 0.0000)
               ("DIMARCSYM" 2)
               ("DIMASZ" 2.5000)
               ("DIMATFIT" 3)
               ("DIMAUNIT" 0)
               ("DIMAZIN" 0)
              )
 (apply 'setvar item)
)

Posted

... foreach + apply combo beats mapcar... Alanjt Wins.

Posted
Good work blueshake.

 

And here is another way with the same result if you would like to. And with some corrections as following .

Check this out .

 

(defun build_dimstyle (/)
(if (not (tblsearch "dimstyle" "standard"))
	 (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "??")
	 (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]r" "standard")
        )
(princ "start setting")
(mapcar 'setvar '("dimtxt" "DIMADEC" "DIMALTRND" "DIMARCSYM" "DIMASZ" "DIMATFIT" "DIMAUNIT" "DIMAZIN")
'(3.5 2 0.0000 2 2.5000 3 0 0))
(command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "standard" "[color="red"]_[/color]yes")
 )

 

Besides that, you can use the dimstyle entmake to dimstyle as well and which is a little bit faster .

 

Good luck

 

Tharwat

 

thanks.

but what is the difference between dimstyle and _.-dimstyle?

and what is the mean of symbol "??"

Posted (edited)
thanks.

but what is the difference between dimstyle and _.-dimstyle?

and what is the mean of symbol "??"

 

The underscore ===> _dimstyle .... allows translation into other languages

The dot ===> .dimstyle ..... means to use the true definition of the command rather than user defined

The hyphen ===> -dimstyle ..... forces the command line version (that's just what I've read; I'm not exactly sure what it means, however)

 

 

For a good set of tutorials you might want to check this site out. It's got plenty of good information:

http://www.afralisp.net/index.php

Edited by Steven Erickson
correct misspelled word
Posted
The underscore ===> _dimstyle .... allows translation into other languages

The dot ===> .dimstyle ..... means to use the true definition of the command rather than user defined

The hyphen ===> -dimstyle ..... forces the command line version (that's just what I've read; I'm not exactly sure what it means, however)

 

 

For a good set of tutorials you might want to check this site out. It's got plenty of good information:

http://www.afralisp.net/index.php

 

thank you for your reply.

Posted
... foreach + apply combo beats mapcar... Alanjt Wins.

In this situation, I'm just not a fan of breaking up a list. If one wants to make changes down the line, it will be a lot easier if the settings are together, rather than in two separate lists. I liked stepping through a list of dotted pairs and using (setvar (car x) (cdr x)).

Posted
In this situation, I'm just not a fan of breaking up a list. If one wants to make changes down the line, it will be a lot easier if the settings are together, rather than in two separate lists. I liked stepping through a list of dotted pairs and using (setvar (car x) (cdr x)).

 

As always, I appreciate the explanation. I've never thought to set sysvars in this manor, and I'm sure I'm not the only one. You've, how the hippies put it... "blown my mind." :wink:

Posted
As always, I appreciate the explanation. I've never thought to set sysvars in this manor, and I'm sure I'm not the only one. You've, how the hippies put it... "blown my mind." :wink:
I'm not saying there's anything wrong with using mapcar and two lists, I use it myself when setting/storing system variables (cmdecho, etc.) within a routine. However, in this situation, when needing to look at a clear and concise list of variables and settings, I would rather keep a format that is a little easier to look at and edit.

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