autocad and solidworks

Werner Almesberger werner at almesberger.net
Fri Sep 2 13:09:48 EDT 2011


Bas Wijnen wrote:
> but finishing hasn't been my strength. I see the same
> problem with many other software developers.

Heh, I think I know exactly what you mean :-)

> I think this is what you're
> seeing. "the problem can be solved, let's move on to the next
> challenge."

Dunno if this is a case of just not completing the job. It seems
pretty fundamental. Parametric modeling isn't something you just
tack onto an existing system. You need to structure the system
for it. But still, more than 90% of the work go into the GUI and
infrastructure you need because of the GUI (such as the ability
to select or delete items.)

If you've already written a CAD system (i.e., you know every bit
of the design and the code really well), then it may make sense
to try to "upgrade" it to parametric modeling. Otherwise, you're
probably better off doing it from scratch.

To illustrate what I mean, let me explain how fped does it.
There are variables, plus the following two fundamental types
of items:

- objects, which are the things the user specifies. E.g., the
  following instructions

  set r = 1mm
  foo: vec @(r, 0mm)
  circ foo bar

  would create a vector from the origin (@) with length (r, 0),
  and then a circle centered at the origin and with its radius
  defined by the point at the end of vector "foo".

  (You can of course create all this from the GUI, without
  entering commands. Fped saves designs in the scripting
  language, so you can always go and edit the script, even if
  you've only used the GUI so far.)

- instances, which are the things the user sees. In the above
  example, this would generate the following instances:

  - type "vector", from (0, 0) mm to (1, 0) mm
  - type "circle", center (0, 0) mm, radius 1 mm, default
    line width

In the GUI, the instances are drawn. Objects are only visible
via their instances. When you click on an instance, fped
highlights the instance you've selected, shows you some
properties of the instance, and lets you edit the _object_
parameters. This is less confusing than it may sound :-)

Each time a variable or an object changes, all the instaces are
re-calculated and the screen content is redrawn. Thanks to the
insane speed of modern CPUs, you only notice just how
inefficient all this is if editing some monster BGA ;-)

Fped needs this strict separation between objects and instances
because you can also create multiple instances from a single
object, e.g., by the equivalent of a loop or the equivalent of a
subroutine.

A CAD system that doesn't have such a multiplication feature
(although at least "subroutines" would be useful) could use the
same data structure for objects and instances.

- Werner




More information about the discussion mailing list


interactive