Recent Posts

Pages: 1 2 [3] 4 5 ... 10
COM, OLE Automation, .NET / Re: How to use Python with DesignCAD
« Last post by Zarathustra on October 09, 2017, 09:06:29 AM »
Hello Members I'm down from the Mountain  ;)

Here is my first attempt with COM and Python. It think it should work. I tested with DC23.

import sys
import wx
from comtypes.client import GetActiveObject as gao
from ctypes import c_double, byref

def Mitteilung(Titel, Nachricht):
    app = wx.App()
    frame = wx.Frame(None)
    wx.MessageDialog(None, Nachricht, Titel, wx.OK | wx.ICON_INFORMATION).ShowModal()

def main():
        DcApp = gao("DesignCAD.Application.23")
        Mitteilung("Makro Einspurmodell","Einspurmodell gestartet!")
        Mitteilung("Kein DesignCAD", "Bitte zuerst DesignCAD starten, Abbruch!")

    DcApp.Visible = True

    DcDoc = gao("DesignCAD.DCD-Document.23")

    DcPlane = DcDoc.Plane
    DcCurve = DcDoc.Curve
    DcPts = DcDoc.CmdPoints

    x = c_double()
    y = c_double()
    z = c_double()
    DcPts.GetUserPoint(byref(x), byref(y), byref(z))

    DcPts.SetCommandPoint(0. + x.value, 0. + y.value, 0. + z.value)
    DcPts.SetCommandPoint(10. + x.value, 0. + y.value, 0. + z.value)
    DcPts.SetCommandPoint(5. + x.value, 8.6667 + y.value, 0. + z.value)
    DcPlane.DrawType = 0

if __name__ == '__main__':

There is only a Messagebox from wxPython, therefore "import wx". But in future, i try to use wxPython for  GUI-Programming because of wxFormbuilder for design GUI-Layout.

It was hard for myself to find out how to get values from GetUserPoint. It doesent work for me with win32com.client etc.
You should use oleview.exe to get the Names of the registred Class-Names.

Next Tests are with numpy array and SetCommandPoints

I hope it's not to hard for me...

Greetings from Düsseldorf, Germany
General Discussion / Re: Macro Understanding
« Last post by Lar on October 09, 2017, 07:12:13 AM »

You can't beat macros. Here's a simple example:
   One thing that irritates me (who typically uses hundreds of layers) about dcad is to make a layer current you have to open either the layer dialog or the layer toolbar's list and scroll to the layer (you can also use the same-as finger in the toolbar but that's only if a visible entity resides on that layer). And you will scroll pass that layer back and forth a few times before you find that layer. And what if the filter is set to 'active only', I will have to take the extra step of changing the filter. So what did I do, back in 1990-something? I took a few minutes to write and test a macro where I just type in the number of the layer I want current. This also bypasses that irritating message informing me that a layer that was just off is now on.

I was very happy with that macro for a decade or 2 until I became very irritated that my layer toolbar keeps forgetting that it's supposed to be on when using the 'hide/restore toolbars' command. So what did I do? I enhanced my 'current layer' macro so that I can select an object that I know is on the layer I want current, run the macro and if I just click ok without typing in anything the layer of the selected item will become current.

Even later, after finding myself using the last few layers as utility layers (since I can just hit the 'end' key on the keyboard to access them in the layer dialog, so no scrolling) and having to turn them on often. So here's what I did: I enhanced the macro so that if nothing is selected and I 'ok' without typing in anything then layer 2000 will be current... but only if it was off. If it's on then 1999 will be made current... but only if that was off. If that was also on then 1998 will be made current. There, I've given dcad AI (artificial intelligence).

That's just one very simple example. I have hundreds of macros, many very simple, many very complicated, that I use on a regular basis, and many more I have forgotten I ever wrote.

Without macros dcad would honestly be unusable for me.

General Discussion / Re: Macro Understanding
« Last post by Dr PR on October 08, 2017, 08:30:44 PM »
I agree completely with Bob. The thing I like most about DesignCAD is the extreme flexibility of the user interface. You can change the program to work the way you want it.

For example, the "Make Plane" function is buried many layers deep in the menus, and I found that to be very annoying (I want to spend my time drawing, not opening menu after menu). So I assigned "Make Plane" to a custom tool, and put it in a custom toolbox. I also have "Contour Line" and "Angle between two lines" in my custom tool box, along with a tool to open the Windows charmap.exe program so I can copy symbols into text strings. I used the custom toolbox because these are functions I do not use very often, and I would forget a hot key combination. But they are always visible and accessible with a single click from the custom toolbox.

I use "Intersect 2" very often, so I assigned it to the "Alt X" key combination - that made sense to me. When I first started using DesignCAD (Prodesign back in those days) I could never remember the hot key combination for "Midpoint" because it made no sense to me, so I reassigned it to "CTRL M," and that is still what I use. I use several other custom hot key combinations. Once you have assigned your custom key s they will appear in the menus beside the commands.

But if you do have a sequence of commands you repeat often it may be worth your time to create a macro, like Lar's staircase example. Back in the 90s a fellow I work with wrote a macro to create instrument faces to print out and paste on the face of milliammeters so he could create custom instruments to read in whatever units he wanted (a logarithmic firkins per fortnight meter?). It took him a while to get the macro to work right, but afterward he could do in seconds what it would take an hour or two to do manually. You can assign your macro to a custom tool or a hot key, or add it to a menu.

And if you prefer to do as much as possible with the keyboard, you can type everything into the command line.

General Discussion / DesignCad v6 - W7 XP Mode - how to install
« Last post by marcel.zx on October 08, 2017, 03:25:40 PM »
environment :
- HP ZBook i7
- W7 64bit
- XP Mode working
- DC file conversion working good

problem :
when starting DC6, I have the following error :
The video device failed to initiate for full screen mode

Shortcut Proprieties Notes :
Screen\Usage = Window
Program\Run = Normal Window

questions :

1) Is it possible to run DC4 in W7 XP Mode?
2) If yes, any idea about that problem?
3) If not what do you suggest?
General Discussion / Re: Macro Understanding
« Last post by Bob P on October 08, 2017, 01:35:48 PM »

Designcad has several ways to get things done, and macros are just one of them. Scroll down this page to download a list of all the shortcuts / shortcut keys. Almost all important commands can be done without resorting to the menus.

You can also change the default hotkey assignments, plus you can assign a hotkey to a command currently not listed. Options>keyboard  If you use DC a lot, you can make it your own.
General Discussion / Re: Macro Understanding
« Last post by wisoak on October 08, 2017, 10:21:04 AM »
Thanks, Dr. PR. You said what I probably needed to hear. I would rather spend my time on my 3D drawings than experiment, fail, experiment, probably fail again, maybe spending hours to save a minute with a new macro.
BasicCAD / Re: Delete entity
« Last post by Lar on October 07, 2017, 10:23:46 PM »

Deydope, once you use the entity statements you don't have to set a point to select it. Just tell dcad to select that entity. You can do this the way bdeck just explained, using query and change, or the long winded Getattr and Putattr statements.

General Discussion / Re: Macro Understanding
« Last post by Dr PR on October 07, 2017, 08:43:19 AM »

I guess my comments must seem overly pessimistic, so I should say that macros are one of DesignCAD's exceptional features. The ability to place a macro in a menu, assign it to a hot key or put it in a tool box is VERY useful. I do use macros!

Macros are extremely useful for operations that you repeat frequently. You can execute several commands with a single operation. For example, I use the vc.d3m macro all the time. It sets the View Center where the cursor is and then starts the "Set View by View Center" function that orbits the view around the view center. In fact, I have assigned the macro to the "Y" key, replacing the "Set View by View Center" function for that key.

Without it I would have to execute the "Set View Center" function and then the "Set View by View Center" function. The latter is useless by itself because it orbits the view around some unknown place in the drawing that may be far away from what you want to see.

The operating speed issue is related to the number of objects in a drawing, and that generally relates to file size. The key thing to remember is that macro operating speed is related to the inverse of the number of objects it has to work on:


This is non-linear function, so if you double the number of objects the macros takes four times as long to execute. Just don't create or use macros that have to look at everything in a drawing and then use them in large drawings.

For me the biggest limitation is the inability to use a macro inside another command. For example, I can't use the vc.d3m macro to rotate the view around a specific point while drawing objects in 3D. Most of the time this is exactly when I need to use the macro!

General Discussion / Re: Macro Understanding
« Last post by Bob P on October 07, 2017, 04:01:47 AM »
Dr PR's ship is very impressive, but I've been using DC for 20+ years and, out of thousands of drawings, I have fewer than 20 that are larger than 5mb, and none are bigger than 20mb. Waiting for a macro to execute has never been a problem for me.  On the other hand, searching through menus for a command has always taken too much of my time (and brain memory), so I get around that with macros for almost everything, but I am a comfortable touch-typer.
BasicCAD / Re: Delete entity
« Last post by bdeck on October 06, 2017, 10:56:59 PM »

I had a somewhat similar question years ago, and Lar helped out by pointing me to the (then new) query and change commands.

If you know which entity you want to delete, then this will work:

entity i
change Ent_Selected, 1
Pages: 1 2 [3] 4 5 ... 10