Author Topic: CAD Setup Routine  (Read 63753 times)

0 Members and 1 Guest are viewing this topic.

SMadsen

  • Guest
CAD Setup Routine
« Reply #90 on: January 28, 2004, 02:57:11 PM »
..only wives need arguments

daron

  • Guest
CAD Setup Routine
« Reply #91 on: January 28, 2004, 03:13:53 PM »
hehehe

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
CAD Setup Routine
« Reply #92 on: January 28, 2004, 03:40:32 PM »
And get them they do ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Matt Stachoni

  • Guest
CAD Setup Routine
« Reply #93 on: January 28, 2004, 06:32:33 PM »
I've done quite a bit of "standards enforcement" programming in (v)lisp, and here are some random ideas that have helped me:

1. Have a plan. Don't try to code everything in one shot and allow yourself to think like a programmer. Think in terms of modules of small functions that work together to solve big tasks. Always break the problem down into smaller units. IOW, one function may set up text styles, one may set up layers, another may set up dimstyles, etc.

I've found it very helpful to write long comments of pseudocode or algorthms in plain text that describe the logic breakdown before writing a single piece of code. I do this even for non-programming tasks. Pretty soon you think like this for everything like making cereal to cutting the grass, e.g.

Open Fridge Door
Take Milk Out
If (= Yes EnoughForCereal), (TestMilk)
  otherwise, (MakeToast)
If (= Ok (TestMilk))
  (MakeCereal)
  ((ThrowOutMilk) (MakeToast))

2. Separate code from data. That is, create a text file of your intended Standards settings in an .ini file or some other text file (the extension doesn't matter).  Make them delimited by space or character. For example, a layer standards file might look like:

0 red continuous plot
A-WALLS yellow continuous plot
A-NOPLOT 37 continuous noplot

etc. Do the same for dimension styles and text styles (each a separate file). For annotation styles, set all heights and size values to plotted sizes.

Each kind fo file may have a different data format. In my dimstyles standards file I use mostly Dimvar names in association lists (e.g., ("DIMBLK" . "_ARCHTICK") because it makes implementing it very easy. For text styles, I used a simple assoc. list based on DXF codes for text Styles (e.g., '(2 . "STYLENAME"). for layers it's a bit more cumbersome because we use layer prefixes then std layer names. But easily handled by code.

The point is, pick a format for the type of data and write code around it to process the file easily. With vlisp's extended functions for handling strings, it's super easy.

3. Create a development environment for yourself. Put all of your code and Standards data files into an \Admin folder tree that only you have read/write access to. Create a parallel \Company folder for everyone else. Develop, test and compile in \Admin, copy the fas/vlx/lsp files to the \Company tree for implementation. Make subfolders for resources, menus, apps, sourcecode, vlx, etc.

Each normal user has their profile Support Files path point to the \Company tree, yours points to \Admin. You are always in development mode, they are always using solid code. You can screw up without torpedoing the entire company.

4. Create very general code functions that process the files. The functions simple read the files in line by line into a big list, then parse the list for the intended fields. Then apply the settings to the layers/dimensions/styles, either through a simple (command "layer") call or through ActiveX.

By doing this you make sure that someone doesn't have to know how to code AutoLISP or VBA to modify the standards. This is important if you get hit by a bus.

Not only that, but it's portable, so you can migrate the same data files to VBA if you want to do so withou recoding the standards themselves.

5. For annot. styles, wrap everything up into a single general function that sets all scale-dependent settings in one shot. If you do annotations in MS, then you can simply execute a function like this (annotsetup "Standards" 96.0) which

a) sets a global LTSCALE size
b) reads the settings for text styles from standards.txt and sets them accordingly,
c) reads the dimensions text file from "standards.dim" and sets up a dimstyle and all child dimstyles

Since we do all annotaiton in MS and use Xrefs extensively, we can get away with using one - and only one - dimstyle per drawing, so all of our dwgs have a dimestyle called ARCHITECT. Each file has one annotation scale; everything is the same except for the all-important DIMSCALE system variable.

3. Wrap everything up into simple cascading menus. I generally don't use Templates because they are tougher to maintain over time, and it's easier to manage a few simple text files that set all standards.

Instead, I have my users start all of their drawings with the same template (acad.dwt) which is "clean" - no layers/dimstyles/text styles. Then they step through two cascading menus - one to load layers, another to set the scale which also sets text/dim styles and ltscale. Since we do Architectural work, the layers pulldown has different entries for loading separate sets of layers (new, demo, existing, RCP, furniture, etc).

Hope it helps to give you ideas.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
CAD Setup Routine
« Reply #94 on: January 28, 2004, 06:46:09 PM »
Excellent piece Matt. I know we can all learn a thing or two by following your advise. Why don't you sign up as a member, I would be glad to have you and your knowledge hanging around TheSwamp. :D
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
CAD Setup Routine
« Reply #95 on: January 28, 2004, 07:38:29 PM »
Very good Matt.

I am a one man operation so I use template files with most things set up.
Having separate templates for one or two or three story houses,
One for site and another for details. But I have found that when I decide
to change something I may have to revisit all templates.

Your suggestion would be a lot of work for me initially but I think it would
pay off in the long run even for a one man operation.


Thanks for the info.

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
CAD Setup Routine
« Reply #96 on: January 28, 2004, 08:33:44 PM »
Incedently, I used to work at a place where the drawing standards were implemented using code to a point, and also layers. It was a simple process. When you want to load all of the layers, a blank drawing was inserted as an exploded block. Thus the traits of the new block made the required attributes of the drawing. One for linetypes, one for layers, one for textstyles etc ... yes there are files to maintain, just like a template, BUT, the files can be maintained even by a novice. The simple thing being if you want to add or modify a layer, simply change the layer drawing. There was a little more to it than that, but it also allowed us to have different combinations of the same standards for different projects. In other words layer set #1 and texstyle set #3 or layers #2 and textstyles #3 etc...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

amgirard2003

  • Guest
CAD Setup Routine
« Reply #97 on: January 29, 2004, 09:45:01 AM »
I'm glad to see i've attracted quite a bit of attention and input here...

amgirard2003

  • Guest
CAD Setup Routine
« Reply #98 on: January 29, 2004, 09:54:10 AM »
O.k... let's get back on track here..
Through reading the posts that have been posted and getting
the fact that i should break things down to it's simplest form to make
it easier to work with.

In that case I'm doing the following

With the layers i will make one routine to load the layers
and i will make another to reload them..

Now where do i begin with the reloading..
I'm slowly walking through this process... so give me a little time and i will post any problems that i have.

daron

  • Guest
CAD Setup Routine
« Reply #99 on: January 29, 2004, 10:39:32 AM »
Load and reload? That can be done in one, I'm sure, since, if a layer exists you won't overwrite it, but you may alter its properties. That can definately be a good thing. Now, let's say you take Keith's function for creating a layer. You don't call it alone. Call it in a command line program the way we helped you understand the arguments idea. So, you could either do this:
Code: [Select]
(mlayer "Andre" 6 1 0 0)
(mlayer "Bob" 5 1 0 0)
(mlayer "3" 4 1 0 0)
(mlayer "4" 3 1 0 0)
(mlayer "5" 2 1 0 0)
(mlayer "6" 1 1 0 0)
(mlayer "7" 7 1 0 0)

which is fine, but that can get really large as you input more layers. Another way, and there are many would be to put the elements in a list and use one of the many ways that exist to process lists, i.e. mapcar, foreach... Study the help files on those and ask questions about them.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #100 on: January 29, 2004, 10:54:17 AM »
Quote from: Daron
Load and reload? That can be done in one


Wouldn't it be simpler for me to do it in 2 parts for right now until i get a clear head as to what i'm doing, and then at that point i could modify it and combine them together..

And one other thing.. adding to the list...
what other functions besides mapcar and foreach should i really be looking at?

daron

  • Guest
CAD Setup Routine
« Reply #101 on: January 29, 2004, 11:35:24 AM »
repeat, while, lambda. The two I originally gave you are the most common and easiest for processing unknown number item lists. Repeat is similar to foreach, but you can designate a fixed number and it doesn't have to process lists. It's also the easiest, IMO, to use. I didn't suggest it, because I think making a list of your layers and properties would be most ideal as well as easy to update.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #102 on: January 29, 2004, 11:44:25 AM »
I'll run through some Pseudo Code for ya and you can check and see if i'm on the right path.

First create all layers and load them into the drawing.
Next set all the layers to a list for future reference. (reference layer list)

Now when resetting layers set all the current layers in the
drawing to a new list (current layer list).

Now check the (current layer list) to the (reference layer list)
Foreach layer that doesn't exist, re-load the original layer from the (reference layer list).

Does that make any sense to anyone?
and Secondly because i don't know what the possibilities of Autolisp are can you even do something like this or do i have to tweak my thinking?

I appreciate all input on this

daron

  • Guest
CAD Setup Routine
« Reply #103 on: January 29, 2004, 12:14:29 PM »
I suppose you could do that, but what say you a user inadvertantly set a layer that you want green, blue. Running this layer standard routine should be able to set that back automatically. I don't think you need to worry if the layer exists nor do you need a cross-reference list. Just have a list like so
(setq layname '("andre" "bob" "joe" "1" "2" "3'))
(setq laycol '(1 2 3 4 5 6)
in the lisp. You can update the lisp as you need to.
Multi-dimensioned safearrays come to mind, but you aren't ready for those yet. Plus, I think lisp has trouble with those sometimes.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #104 on: January 29, 2004, 12:33:48 PM »
hmmm......  :?  :?