FCPD is a set of FreeCAD python macros and Pure-Data (aka PD) patches to link the two software.
This repository is no more maintained, please use FCPDWorkbench.
FreeCAD is more than a CAD and Pure-Data is more than "a free real-time computer music system". Using a real-time visual programming language to control FreeCAD can results in an orchestrated animation system or a procedural modeling one. Or the reverse, imagine a real-time performance with visual/musical effects controlled by FreeCAD virtual objects.
As you can start to see, imagination and programming skill are one's only limitation when using FCPD.
External libraries are needed for Pure-Data :
- list-abs
- iemlib See Pure-Data documentation to install them or use an already populated distribution as Purr-Data.
- Copy (or link) the FCPD/FreeCAD folder content in your FreeCAD macro path.
- Copy the FCPD/Pure-Data folder content in a Pure-Data accessible location.
See Sample/PdAccessObjectProperties.FCMacro for an example
- Import the pdserver module in your macro
- instantiate a
pdserver.PureDataServer
object with address and port to listen to as constructor arguments - set the default message handler i.e. function which take the incoming message as argument and return a stringable value to give back to Pure-Data
- with message handler registration system you can use different function depending of the first word of the incoming message. Simply call
PureDataServer.register_message_handler([first_word], function_to_call)
- run the server with
pureDataServer.run()
See Sample/test.pd for an example
- Use a
[declare -path ]
object to let Pure-Data know where to find the FCPD objects - Add a
[fc_client]
object with these arguments- Remote IP address of the (remote) computer on which the FreeCAD pdserver is listening
- Remote port of the (remote) computer on which the FreeCAD pdserver is listening
- Local port on which the remote FreeCAD can callback
- '
1
' for autoconnect (try to connect every second)
- Communicate with FreeCAD throw
[fc_process]
PD objects are documented. Access help via Right mouse button(RMB) > Help
Pure-Data messages are text only so the FreeCAD objects have to be converted to and from string to be processed with Pure-Data.
The PureDataServer object automatically remove non-conform characters of the callback message i.e. ,
and =
are converted to space and ';()\[\]{}"
are removed. In this way the Base.Vector
python object whose string representation is Vector(0.0,0.0,0.0)
can be a return value of a message handler and converted to Vector 0.0 0.0 0.0
PD message.
Bugs, feature requests, and inquiries ? Please open tickets in the repo's issue queue.
Copyright 2020 @flachyjoe and other contributors
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.