Author Topic: Need help with programming in DesignCAD  (Read 134 times)

DBS99

  • Newbie
  • *
  • Posts: 2
Need help with programming in DesignCAD
« on: December 18, 2017, 07:17:10 PM »
I am using DesignCad 3D Max 23.  I just recently started doing some pretty intense macro writing using Basic Cad and would like to do more sophisticated things.  I have a lot of experience coding with VBA in Excel and am wondering is there a way for me to do macros in Design Cad using VB or a similar language rather than being limited to using Basic Cad macros.  For example, I used a macro to insert parallel lines of even spacing and trimming them to a pre-existing curved line above them and a curved line below them.
It worked okay but I believer it would have worked better if I could have named the curved lines and named each line my macro inserted and them figured out way to call each entity by name and trim the new lines to he curved lines.  Not sure what that code would look like but I do know I could do more by being able to write more spohistcated code.  I just don't know how to do that with Design Cad.

Lar

  • Hero Member
  • *****
  • Posts: 2633
Re: Need help with programming in DesignCAD
« Reply #1 on: December 19, 2017, 06:24:09 AM »


Maybe this link can help you:
http://forum.designcadcommunity.com/index.php?topic=1537.0

I know you can use VB for macros but I don't use it myself. The member who I know to us it the most (Prl) hasn't been heard from on this forum for a few years now. Other than him, Droll Troll would be the expert on everything dcad.

One thing I found very strange about non-basiccad macros was many years back when someone (it may have been Prl) was complaining that his macros were very slow. I responded that how can this be because my layer macros for example (where I would run a macro to write another macro that saved the layer statuses as they were right then and later when I needed that layer setup again I would run the 2nd macro) would run through all two thousand layers before my mouse finger relaxed from double clicking the macro name in the 'open file' dialog box. Come to find out he was using VB or something and all that compiling stuff slowed down his macros considerably. I don't know if it's any faster now'a days. One thing that did charm me about VB was the ability to create your own dialog boxes, which basiccad totally lacks. Another thing is every VB macro requires a 2nd file for some reason, but I guess you are familiar with all that.


Lar
ps: my macros that actually draw stuff and perform 3d tasks also execute very quickly...
« Last Edit: December 19, 2017, 06:37:19 AM by Lar »

DBS99

  • Newbie
  • *
  • Posts: 2
Re: Need help with programming in DesignCAD
« Reply #2 on: December 19, 2017, 07:53:29 PM »
Thanks for the reply Lar.

I am not opposed to BasicCad macros at all and find them quite useful.  However as a newbie, my belief is they are limited to existing DesingCad commands and I am hoping by using VB I can do tasks that are not possible using existing DesignCad commands.  For example, the only command I know for trimming or extending one line to another requires you to select the command first and then select the lines.  For what I need to do, it would work much better (I think) to select the two entities (in this case lines) by name and then trim or extend one to the other.  If there is a DesignCad command that achieves this and I can call that command up in a BasicCad macro, I am fine with using that method.  I have a Basic Cad macro I wrote that is inserting a lot of vertical lines automatically and I need to trim or extend them to existing curves running mostly horizontal and then get the endpoint coordinates of all the lines I added and trimmed.  I have exrything working great except for some lines end up being outside the horizontal curves and some end up between them.  I do not know ahead of time which ones will fall into each of these categories, so trying to select the trim command ahead of time and then select points on the curves does not work real well because the curves are already existing in a drawing I am getting from a customer.

BlankMan

  • Newbie
  • *
  • Posts: 31
Re: Need help with programming in DesignCAD
« Reply #3 on: January 10, 2018, 06:44:16 AM »
My current main project in DesignCAD MAX 2018. An electronics project enclosure, Completely drawn using BasicCAD. Just over 4,900 lines of code. Turns out to be the most lines of code ever for a DC drawing in 25+ years of doing this.

Done this way for prototyping using variables for the various component dimensions so the part dimensions, location, and orientation can be easily changed as needed.

Newbie? Not.
Been using DesignCAD 3D since ~1990
Still have version 4 floppies...

Dr PR

  • Hero Member
  • *****
  • Posts: 5499
Re: Need help with programming in DesignCAD
« Reply #4 on: January 10, 2018, 10:20:23 AM »
Just curious - any idea how long it took to write those 4900 lines of code?

Phil
DesignCAD user since 1987

BlankMan

  • Newbie
  • *
  • Posts: 31
Re: Need help with programming in DesignCAD
« Reply #5 on: January 12, 2018, 01:41:41 PM »
I started it around the 27th and it progressed from there. Been many many incarnations and adjustments made and changes as the electronic design changed. Probably made 8 or so on the printer so far, one bottom is printing now. Not really done yet either. Have all the components now for test fits though. Have to move the fan to accommodate a bracket that will attach to the top for a touchscreen display which still needs to be drawn.

BTW This all has been done by subtraction only, not a single add. Whereas in the past a combination of both were used. But DCAD still manages to screw up the OBJ and STL exports. Cannot do them correctly.
Newbie? Not.
Been using DesignCAD 3D since ~1990
Still have version 4 floppies...