Jump to content

Problem with macro for creating several dimensional styles


Sandervp

Recommended Posts

Problem command for creating dimension style

 

 

 

I've got a command, beneath a toolbar button, which shall create several dimensional styles for different scales. If I have got a drawing with different dimensional styles, and none of these has got the same name as any dimensional style my command shall create, nothing is wrong.

 

But if there is 1 existing style with the same name as one dimensional style my command shall create, it goes wrong.

 

 

My command creates the following dimensional styles:

Scale_1-10

scale_1-20

scale_1-25

scale_1-50

scale_1_100

 

This is the first part of the macro which creates the scale_1-10 dimensional style:

 

^C^C_dimclrd;1;
 dimltype;continuous;
  _dimlwd;-1;
   _dimdle;1.25;
    _dimdli;1.25;
     _dimclre;1;
      _dimltex1;continuous;
       _dimltex2;continuous;
        _dimlwe;-1;
         _dimexe;1.25;
          _dimexo;1.25;
           _dimblk;oblique;
            _dimldrblk;oblique;
             _dimasz;2.5;
              _dimcen;0;
               -style;isocp;isocp.shx;a;;;0;;;;;
                _dimtxsty;isocp;
                 _Dimclrt;2;
                  _dimtfill;0;
                   _dimtxt;1.8;
                    _dimtad;1;
                     _dimgap;1;
                      _dimtoh;off;
                       _dimtih;off;
                        _dimtmove;0;
                         _dimscale;10;
                          _dimdec;0;
                           _dimzin;0;
                            _dimtolj;0;
                             _dimse1;off;
                              _dimse2;off;
                               _dimrnd;5;
                                _dimtofl;on;
                                 -dimstyle;s;SCALE_1-10;

 

The other part of the macro creates the other dimensional styles and is just placed after this part.

 

 

If I use this macro/button and 1 of these styles is in use, and the command is creating him again, the following text is visible in my text window:

 

Current dimension style: SCHAAL_1-25 Annotative: No

Current dimension overrides:

DIMSCALE 10.0000

Enter a dimension style option

[ANnotative/Save/Restore/STatus/Variables/Apply/?] : s

 

Enter name for new dimension style or [?]: SCHAAL_1-10

 

That name is already in use, redefine it? :

 

Enter name for new dimension style or [?]:

 

 

The command ends at this point. I do not have all the dimensional styles that I want to have.

 

How can I change my macro string to solve this problem?

 

 

Thank you for your advice.

 

 

This is the whole macro string:

 

^C^C_dimclrd;1;dimltype;continuous;_dimlwd;-1;_dimdle;1.25;_dimdli;1.25;_dimclre;1;_dimltex1;continuous;_dimltex2;continuous;_dimlwe;-1;_dimexe;1.25;_dimexo;1.25;_dimblk;oblique;_dimldrblk;oblique;_dimasz;2.5;_dimcen;0;-style;isocp;isocp.shx;a;;;0;;;;;_dimtxsty;isocp;_Dimclrt;2;_dimtfill;0;_dimtxt;1.8;_dimtad;1;_dimgap;1;_dimtoh;off;_dimtih;off;_dimtmove;0;_dimscale;10;_dimdec;0;_dimzin;0;_dimtolj;0;_dimse1;off;_dimse2;off;_dimrnd;5;_dimtofl;on;-dimstyle;s;SCHAAL_1-10;
_dimclrd;1;dimltype;continuous;_dimlwd;-1;_dimdle;1.25;_dimdli;1.25;_dimclre;1;_dimltex1;continuous;_dimltex2;continuous;_dimlwe;-1;_dimexe;1.25;_dimexo;1.25;_dimblk;oblique;_dimldrblk;oblique;_dimasz;2.5;_dimcen;0;-style;isocp;isocp.shx;a;;;0;;;;;_dimtxsty;isocp;_Dimclrt;2;_dimtfill;0;_dimtxt;1.8;_dimtad;1;_dimgap;1;_dimtoh;off;_dimtih;off;_dimtmove;0;_dimscale;20;_dimdec;0;_dimzin;0;_dimtolj;0;_dimse1;off;_dimse2;off;_dimrnd;5;_dimtofl;on;-dimstyle;s;SCHAAL_1-20;
_dimclrd;1;dimltype;continuous;_dimlwd;-1;_dimdle;1.25;_dimdli;1.25;_dimclre;1;_dimltex1;continuous;_dimltex2;continuous;_dimlwe;-1;_dimexe;1.25;_dimexo;1.25;_dimblk;oblique;_dimldrblk;oblique;_dimasz;2.5;_dimcen;0;-style;isocp;isocp.shx;a;;;0;;;;;_dimtxsty;isocp;_Dimclrt;2;_dimtfill;0;_dimtxt;1.8;_dimtad;1;_dimgap;1;_dimtoh;off;_dimtih;off;_dimtmove;0;_dimscale;100;_dimdec;0;_dimzin;0;_dimtolj;0;_dimse1;off;_dimse2;off;_dimrnd;5;_dimtofl;on;-dimstyle;s;SCHAAL_1-100;
_dimclrd;1;dimltype;continuous;_dimlwd;-1;_dimdle;1.25;_dimdli;1.25;_dimclre;1;_dimltex1;continuous;_dimltex2;continuous;_dimlwe;-1;_dimexe;1.25;_dimexo;1.25;_dimblk;oblique;_dimldrblk;oblique;_dimasz;2.5;_dimcen;0;-style;isocp;isocp.shx;a;;;0;;;;;_dimtxsty;isocp;_Dimclrt;2;_dimtfill;0;_dimtxt;1.8;_dimtad;1;_dimgap;1;_dimtoh;off;_dimtih;off;_dimtmove;0;_dimscale;25;_dimdec;0;_dimzin;0;_dimtolj;0;_dimse1;off;_dimse2;off;_dimrnd;5;_dimtofl;on;-dimstyle;s;SCHAAL_1-25;
_dimclrd;1;dimltype;continuous;_dimlwd;-1;_dimdle;1.25;_dimdli;1.25;_dimclre;1;_dimltex1;continuous;_dimltex2;continuous;_dimlwe;-1;_dimexe;1.25;_dimexo;1.25;_dimblk;oblique;_dimldrblk;oblique;_dimasz;2.5;_dimcen;0;-style;isocp;isocp.shx;a;;;0;;;;;_dimtxsty;isocp;_Dimclrt;2;_dimtfill;0;_dimtxt;1.8;_dimtad;1;_dimgap;1;_dimtoh;off;_dimtih;off;_dimtmove;0;_dimscale;50;_dimdec;0;_dimzin;0;_dimtolj;0;_dimse1;off;_dimse2;off;_dimrnd;5;_dimtofl;on;-dimstyle;s;SCHAAL_1-50;

Edited by Sandervp
Reply SLW210: Please read the Code Posting Guidelines and edit your post to include the Macros in Code Tags.
Link to comment
Share on other sites

Welcome to CADTutor. :)

 

Might you consider adding these dimension styles into your .dwt TEMPLATE of choice?

Any which you need will be there, any you don't will be purged later, if not used?

 

There are guidelines on the forum for how to post executables,

it would be appreciated if you follow those guidelines. :)

Link to comment
Share on other sites

How about putting the dimension styles in a separate block & just insert it into your drawing by macro?

 

Agreed.

OP, unless you need to alter the creation parameters at run-time, just create them somewhere once and insert as needed by inserting the drawing, DesignCenter, etc.

Link to comment
Share on other sites

Templates and Design Center are the key to having them available. I'd also suggest replacing dimension styles for all those scales with one annotative one you could use in any scaled viewport or even paper space. It sure made my life simpler when they added that years ago.

Link to comment
Share on other sites

If you convert your macro to a lisp then 1st step is check if it exists if not then run.

 

Example:

(tblsearch "dimstyle" "SCHAAL_1-10")

will returns that entry. If no entry is found, tblsearch returns nil. Use it as a test and modify the dimstyle if true, add it otherwise.

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