DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Command Window Question

Started by cressjl, February 08, 2012, 10:15:37 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

cressjl

I have been using DraftSight, simply because it is free, it supports a limited 3D ability (it does support the Extrude command), and it supports a script-input capability.  I became frustrated, however, when my deck design required a deck board be cut at an angle, requiring a 3D Trim that is not supported by this essentially 2D program.  No problem, DraftSight was a good tool for what I needed it for.

Now I await DesignCAD 3D (on order); however, I am interested to know if it supports a full range of script input.  In other words, can you type a full range of commands from the keyboard?  Can you also enter those commands into a file and have them executed, much like AutoC@D?

This may seem crazy, but I use u$ Excel to generate my commands.  I have created Excel functions that handle architectural units, allowing me to add in feet, inches, fractional inches, convert from feet to inches, to decimal feet, add ranges of architectural values, etc.  I then can develop a project basically as an Excel spreadsheet containing one tab per drawing layer, with all constants at the top.  When I get to the end, I don't save drawings, just the spreadsheet!  The spreadsheet becomes the precise record of all drawing commands, with blocks that I can later copy and paste into other projects as required.  I also rarely dimension a drawing since the precise calculations are given in the spreadsheet.

Anyway, with the commands in a column, composed from combining additonal columns, one for command and ones for x, y, and z values, I can simply copy the first column into Notepad and save as a script that I execute in DraftSight.  I am hoping to be able to go through a similar process in DesignCAD.  

Thanks for your help in advance.  This certainly looks like a great community of users!

Lar

#1
Quote from: cressjl on February 08, 2012, 10:15:37 AM
... I am interested to know if it supports a full range of script input.  In other words, can you type a full range of commands from the keyboard?  Can you also enter those commands into a file and have them executed, much like AutoC@D?

I think the answer to these questions are 'yes', depending on what you mean by 'full range'.

You can issue a command by tying it's name or an alias (short form) in the 'command line' (hit the spacebar to get this). Once you get familiar with a command's parameters you can also type the parameter's value in the correct order and the command will be executed without you having to be bothered with dialog boxes (you type the command and the parameters in a single line so you don't have to wait for the program to ask you question after question in robotic fashion). I don't use this feature myself so others who do will have better info. Note that once you enter values in most dialog boxes the parameters stick so sometimes you can call up a command and immediately hit the enter key to complete the command using the last set of parameters. For some commands I know the amount of tabs to press to get to a particular field that needs changing so I would issue and complete a command without ever looking at the dialog box. The last 20 or so entries in the command line are saved (between sessions) so you can hit the spacebar and roll the mouse wheel down to an entry or click the little down arrow for the list to drop, then you click it with the mouse to select it. In earlier versions it was possible to hit the first letter of a command line entry to jump to it but that does not work in the later versions.

Dcad has its own macro language called BasicCAD that allows you to write you own personal commands. It is more like Basic, as the name suggests, but the program also allows you to use more coded type languages like c(++). Macros are external files that you create with something like Notepad so I'm not sure how you'll get Excell to issue commands. I do know that basiccad can access other external files that would hold the data to be used in the macro. Basiccad is relatively simple to write once you have all the resource information (easy to obtain) but you have to be intimately familiar with the workings of commands. When you get to know dcad's little quirks you can take advantage of these to do some very interesting stuff.

Lar

Dr PR

cressjl,

Yes and no.

You can execute functions or commands five ways in DesignCAD:

1. On a command line, as Lar mentioned.
2. With key combinations (hot keys). You can assign your own custom key combinations to commands.
3. Pull-down menus.
4. Tool box icons. You can create your own custom toolboxes.
5. Macros. You can create your own custom macros.

DesignCAD has command line input, and an option for a multi-line command bar. However, in the 22 years I have used the program I haven't used it once. I don't know about cutting and pasting multi-line commands into the command bar. Perhaps a more experienced user can elaborate upon that.

Macros are sequences of commands that you want to repeat. You can create macros in two ways:

1. Start macro recording, they execute a sequence of functions, stop macro recording, and save the macro in a named file.
2. Write macros in the macro programming language and save them in a macro file.

You can edit any macro to modify it. So you could create a starting macro as in step 1 above, and then edit it later. You can call up a macro at any time in any drawing.

Macros can be extremely complex. For example, a fellow I work with created a macro to to draw custom instrument faces, like ammeters, voltmeters, etc. He just starts the macro which then prompts him for values, such as diameter, range, units, etc. and then the macro creates the drawing.

In theory you might be able to use Excel to generate macro sequences. Perhaps a more experienced user can address that issue.

DesignCAD can read XYZ data files (delimited ASCII text) and create lines or point fields in the drawing. I have used Excell to calculate the X, Y and Z values, but I have to copy/paste the columns into an editor line Notepad that doesn't put a bunch of extraneous garbage in the file. Then I save the text file and import it into DesignCAD.

One last thing. DesignCAD has been around since 1987 (perhaps a bit earlier) and for the most part it is backward compatible with earlier versions. Occasionally something changes that requires rewriting a part of a macro, but command execution hasn't changed much over the decades, and isn't likely to change much in the future. So you don't have to rewrite your macros with each new version.

One way or another you might be able to do something similar to what you have been doing with DreaftSight. However, it would be nothing short of a miracle if the Excel procedures you have been using would create something that works in DesignCAD.

Phil
DesignCAD user since 1987

Rob S

QuoteIn theory you might be able to use Excel to generate macro sequences. Perhaps a more experienced user can address that issue.

Compared to yourself, Phil, it would be quite a stretch of the imagination to find such a thing.

A burst of false modesty, I'm sure  :D
User since forever

Dr PR

Rob,

Thanks. But I am far less experienced in using the command line or macros that many others on this forum.

I cut my teeth on macro assemblers - I once created a set of macros to allow an assembler written for the Intel 8080 8-bit processor to generate code for a Motorola 6800 16-bit processor. That was quite a trick, and it worked!

I used to write whole sets of macros to adapt my favorite programs to do things I wanted them to - just to have the programmers change the macro language and break my macros. After this happened several times I gave up on macros. I was spending far more time rewriting them than I was using them.

DesignCAD has been pretty good about not screwing up the macro language. Nevertheless, there have been changes over the years - necessary changes - that have broken macros. I still remember the frustrations of getting a program to work the way I want it to only to have all my work wasted by some bozo who wanted to "improve" the macro language. So I haven't written a DesignCAD macro (or a macro for any other program) in at least 15 years.

I use a few macros that others have written, but I have no desire to relive all the frustration that macro writing caused.

Phil
DesignCAD user since 1987

Lar

Doc, I feel a bit of what you're talking about. In the dos days dcad macros could run in the middle of a drawing command so I had macros to set points for me. Eg, I had some that could set points straight up or straight across from the last point. Since dcad changed its macro format and now a macro will abort a running command most of my macros were replaced with actual commands. However, one of my macros could set a point at a 45 degree angle from the last point to a particular but unknown distance or line. This one function has never been replaced and now, if drawing such a segment in a line and there is no existing lines to intersect to, I have to set a temporary point (or points) and come back to fix it after the command is finished.

Other than that, basiccad has been pretty good for me, lacking only the ability to generate custom dialog boxes for macros (I know this can be done with the sdk but I never did get into that). Have no fear, though, I have a solution brewing at this very moment.

Lar

Bob P

Cress,

If your commands are pretty consistent, you can create a standard text file with the values that you wish to feed to the macro, even to the points with which you want to locate and size linked modules (also known as Symbols in DC).

Bob P

Lar,

Will your macros work in Preset Point Mode?

(I wish the old DOS command method of setting the points first was easier in the Windows version...)

MarkX

Quote from: cressjl on February 09, 2012, 02:36:06 PM
I suppose macro generation will have to do.  Considering I wrote macros to do what I do in Excel, it is not beyond the realm of possibilities.  However, macros are somewhat more involved than what I was anticipating.
Be prepared for a shock. The macro language in Excel is leagues better than that of BasicCad. DC's macro language is like something from the 1970s. No object scoping. Can't pass arguments to functions. Depends heavily on knowing dozens (hundreds?) of  SYS() values rather than actual Basic functions. It reminds me more of old mainframe JCL than Basic.

I can't imagine that its changed in the last 22 years, let alone 15.

Change is part of all modern software. Some companies make changes just so they can sell "upgrades" which everyone abhors.  But change that keeps up with industry standards is worthwhile, even if it means you have to spend a day reading the (updated) help manual.

Mark

Lar

#9
Quote from: cressjl on February 09, 2012, 02:36:06 PM
A lot of AutoCAD clones allow for scripts, which route commands to the command line as if they were typed in by the user, but from a text file.  This results in a text file that is as understandable as the command history--simply a list of commands one would enter from the keyboard.

Dcad has a 'macro record' command where you perform a series of commands to create stuff and the commands and parameters are written in a txt file, with the option of setting a 'starting point'. You can run the macro without ever having to open the txt file and your commands will be repeated at macro speed (many macro commands are completed before your finger completely relaxes after clicking the custom icon). If you chose the 'starting point' option then the macro runs relative to the coordinates of your starting point rather than the original absolute coordinates you clicked.

As you get familiar with dcad's commands you can record a macro then edit it to use variables so the user can input values different from the originals.

Quote from: MarkX on February 09, 2012, 04:22:02 PM
...  But change that keeps up with industry standards is worthwhile, even if it means you have to spend a day reading the (updated) help manual.
Change in terms of basiccad means every now and then taking a macro that was written more than a decade ago that you are still happy with and making it even more functional, as opposed to having to rewrite just so it still works.

I've not a C++ guy by any means but I've written code for Cinema 4D (based on C++), which is something I don't look forward to. What I normally do, once I work the c4d code out, is use a basiccad macro that will write the c4d code with data taken from a dcad drawing. I first did this way back in the early 90's to write an autoLISP macro. The basiccad macro can still work but is not necessary anymore. Wonder if the autolisp macro still works in acad.

Lar

Dr PR

Mark,

You are right about both things. I have programmed in very sophisticated macro assemblers, C and C++ (or C-- as one of the high zoot programmers in the company calls my code), and the absence of function calls to pass and return variables really cramps macro programming in DesignCAD. Still, you can do a lot with DesignCAD macros. It is too bad that the sys() functions don't have symbolic names. "Sys(n)" really doesn't tell you much.

Second, we should hope for steady improvements. Actually, there have been few serious changes in Basiccad in the last 15 years, so I don't worry so much about using macros. However, very little of my drawing is repetitious so I have no reasons to create macros. But some people have found great uses for macros - like the structural steel calculation macros that have been posted on the Forum.

Phil
DesignCAD user since 1987

Bob P

As of V17, the maximum program line count (blank lines not included) was 30,000 (with enough memory).

MarkX

Quote from: cressjl on February 10, 2012, 04:36:39 AM
I can't complain about old macro language, especially considering that I still use Corel WordPerfect 8!  Can you believe that it still works just fine in Windows 7?  ::) 
Hi Joel,

Do you have the 32 or 64 bit version of Windows. MS seems to have forced a lot of manufacturers to pack the 64 bit version on machines -- causing lots of old software not to run. In many cases, if you want to run the old software, you have to upgrade to the "Pro" version of Windows. MicroSlob's excuse is that only professionals will want to run old software. Grrrr.

You will probably find the macros in Corel 8 (circa 1998) to be more advanced than the macros in DC (circa 1971).

Mark


MarkX

Hi Lar,

Quote from: Lar on February 09, 2012, 06:50:40 PM
I've not a C++ guy by any means but I've written code for Cinema 4D (based on C++), which is something I don't look forward to.

LOL, well you got me there. Writing in DC BasicCad might be better than writing in C++.

C++ was made for true geeks, with heavy type-casting and inscrutable, long variable names (HK_MMO_DESERT_FUME_WOBBLE_INT).

But somewhere in between these extremes lies modern versions of Basic or other varieties of script languages like Ruby, Python, javascript. Languages with parameters, local variables, and sensible layout structures. TurboCad Pro and Sketchup offer Ruby for instance. Once you've done anything in these languages you really feel disenchanted programming in prehistoric dialects of Basic.

Mark

MarkX

Hi Phil,

Quote from: Dr PR on February 09, 2012, 10:11:51 PM
Second, we should hope for steady improvements. Actually, there have been few serious changes in Basiccad in the last 15 years, so I don't worry so much about using macros.

Yes, I admit its definitely better to have a language than none at all.

Mark