[RFC] Rocketry Workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
concretedog
Posts: 25
Joined: Mon Sep 23, 2019 10:52 am

[RFC] Rocketry Workbench

Postby concretedog » Mon Jan 18, 2021 1:12 pm

Hello!

First of all, massive thanks to the devs and the community for such an amazing project. FreeCAD rocks and I’m proud to use it and also proud to be writing an ongoing series in Hackspace magazine. It’s utterly stunning what’s built into FreeCAD and that’s before we get to addon workbenches where we can design an airplane, boats, get extra 3d print tools, gears etc.

I got into CAD and 3d print mainly as I have the hobby of designing building and flying rockets, from small model stuff up to high power stuff that you need certification and insurance etc to fly. Like this one below, an opensource design I created, ODR, it's about 150cm tall and I've flown it up to about 2.5km in about 18 seconds!
ODR.JPG
ODR.JPG (433.34 KiB) Viewed 2583 times
For a long time I’ve used an opensource java application called openrocket http://openrocket.info/ which not only allows people to design rocket airframes it allows for the designs to be simulated using data for most of the worlds manufactures solid rocket engines for which there are standard datatypes etc. It’s an amazing bit of kit but it’s suffered from a lack of developers and maintainers. Currently is a bit tricky for some users to even get installed as it requires old java runtime environments etc. It’s really well technically documented as the original developer built it as part of his masters degree and his dissertation therefore is a fascinating read. http://openrocket.info/documentation.html

Interestingly, when I design in openrocket I tend to then export or transfer geometries into CAD to create models and or toolpaths often printing nosecones and CNC routing fins and bulkheads from woods or composites. So, and I guess you can see where this is going, I was wondering if there was interest in the community to develop a workbench that could eventually do the job of openrocket, but also directly provide the CAD/models for production. There are also things that FreeCAD could do that openrocket doesn’t, for example openrocket simulates descent rates based on different diameter and drag coefficient parachutes, but it could go further and actually explore parachute design. (I’ve really badly written some annular parachute design calculator scripts in Python).

FWIW I am not a dev, I have a rudimentary knowledge of git etc but I am no coder. I know rocketry inside out and have sat on rocketry councils and delivered workshops on rocket design etc. I think it’s both a really interesting workbench for rocketry types and could bring new people to FreeCAD, it’s also, with my writing hat on, an amazing story to promote and talk about FreeCAD!

It might be that aiming for a complete rocketry design, simulation and modelling workbench is a bit of a hard target, so I wonder if perhaps some simpler workbenches could act as milestones? An idea for this perhaps is a Nosecone Workbench. In rocketry we tend to use a handful of nosecone geometry families and indeed in openscad I’ve used a few generator scripts which in turn are usually informed by the formula on this page;

https://en.wikipedia.org/wiki/Nose_cone_design

I’ve then added shoulders (a cylindrical part at the bottom of the nosecone that slides into the body tube) and other general FreeCAD tasks to make internal geometries for payload or bulkheads etc.

I’d love to see a workbench that could auto generate parametric nosecones!


I’ll stop talking now, anyone interested in this stuff?
User avatar
Kunda1
Posts: 10286
Joined: Thu Jan 05, 2017 9:03 pm

Re: [RFC] Rocketry Workbench

Postby Kunda1 » Mon Jan 18, 2021 1:18 pm

This is awesome. This would be a fantastic niche to address. Also, more rocket scientists in the FreeCAD community... I mean it's a no brainer :ugeek:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 10286
Joined: Thu Jan 05, 2017 9:03 pm

Re: [RFC] Rocketry Workbench

Postby Kunda1 » Mon Jan 18, 2021 1:35 pm

/cc list
Matti03 wrote:
Tue Apr 21, 2020 12:31 pm
I was trying to build this rocket or rather see if I can even do it.
XKC wrote:
Fri Feb 21, 2020 7:02 pm
I want to desing a rocket nose cone, and i find this macro https://www.davesrocketshop.com/?p=194, but when i execute returns this object.
rebeltaz wrote:
Wed Aug 28, 2019 3:19 am
I'm creating this model for a contest, so I can't show all of it here, but I hope someone can help based on what I can show.

One part of the model is a rocket ship.
Raketfued Rockets wrote:
Sun Jan 14, 2018 2:19 pm
Hello FreeCAD Community,
we are a small team of students from Germany who have been building water rockets since 2011.
We have managed to break the German Altitude Record (290m) and have worked a lot on our website and our YouTube channel.
Last year, we had the opportunity to work for the first time with a Ultimaker 2+ 3D printer. We have designed all of our components with FreeCAD and now we want to publish the created files. For that purpose, we want to promote FreeCAD a little bit on our website since we really enjoyed working with this software.
bumper1b wrote:
Thu Dec 14, 2017 2:23 am
This is a model rocket part.
SaturnV_ wrote:
Sun Sep 03, 2017 3:14 pm
Hello,
I am designing a rocket bell nozzle for fun and I sketched out a 2D view of it in the Sketcher. What I would like to do now is to make it into a 3D object. How would I go about making the (truncated) parabolic cone and the (truncated) arc cones? Attached is the file for the 2D bell nozzle.
altertalk wrote:
Sat Aug 13, 2016 8:50 pm
I am attempting to construct shell parts for a 3D printer, and was told to try FreeCAD for such an application. The shell parts I am constructing are for model rockets, starting with motor mount centering rings. These rings center the motor along the body (flight path) of the rocket, and provide a connection to a body that is measurably larger than the rocket motor diameter. The part in particular is constructed from two concentric circles, usually connected with solid material. To save on material and weight, but not strength
dkokron wrote:
Wed Oct 23, 2013 5:34 pm
All,

Thank you for developing FreeCAD.

I am trying to create a nose cone for a model rocket. I would like the nose cone to have an elliptical profile instead of a simple cone shape.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
grandcross
Posts: 153
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: [RFC] Rocketry Workbench

Postby grandcross » Mon Jan 18, 2021 5:24 pm

Hello folks,

I developed a macro for nose cone design that was mentioned in the previous post. If people are having issues with it, I'm happy to give it a look. Similar macros could be used for other parts such as nozzles and motor mounts, and that would probably be quicker in the short term than a full on workbench. I will confess I don't know much about what a workbench would involve so that would take some time to learn.

Hooking in to OpenRocket may be problematic for a few reasons. It is written in Java without a lot of external hooks. They're also struggling to get a new release out for a number of reasons, including relying on older Java versions. They're getting close but there's no firm release target date at this point.

I am a software guy in my non-rocketry life but that also means I take on too many projects as it is. So before I commit to anything here I'd like to have a reasonably solid plan and a good justification for making this a dedicated workbench. Convince me. In the meantime if there's a macro people might find helpful, let me know, and we can start from there.

Dave/aka DavesRocketShop
User avatar
grandcross
Posts: 153
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: [RFC] Rocketry Workbench

Postby grandcross » Mon Jan 18, 2021 6:20 pm

Curse you concretedog for sucking me in!

Thinking through this a little more in the context of Open Rocket. Creating a similar user interface in the model tree will have some challenges. I don't believe the tree has the concept of order at the moment, i.e. nose cone plugs into body tube, fins attach to the ends of the tube, etc. This can of course be handled in the same way assemblies handle it, but I haven't really worked with those so I'll be doing some reading.

But it did occur to me that as an initial problem, writing a macro to import from Open Rocket (and Rocksim) might be useful. You'd still do your design in one of these tools for now, but you could then import the parts for 3D printing, laser cutting, milling or whatever. This functionality would be required as part of any workbench anyways.

Does this solve anyone's immediate problems?
suzanne.soy
Posts: 43
Joined: Sat Dec 19, 2020 11:55 pm

Re: [RFC] Rocketry Workbench

Postby suzanne.soy » Tue Jan 19, 2021 2:22 am

grandcross wrote:
Mon Jan 18, 2021 6:20 pm
Thinking through this a little more in the context of Open Rocket. Creating a similar user interface in the model tree will have some challenges. I don't believe the tree has the concept of order at the moment, i.e. nose cone plugs into body tube, fins attach to the ends of the tube, etc.
To assign sub-items to specific uses, you can use App::PropertyLink properties, and then in the execute() function of your object, move these objects as sub-objects (easiest with App::DocumentObjectGroupPython). I attached an example in which you can define parts as the nose cone, body tube, fins and exhaust. Adding the Assembly[2,3,4] commands and making real rocket parts is left as an exercise to the reader :-p

Code: Select all

import FreeCAD as App

class MyViewObject():
    def __init__(self, viewObj):
        viewObj.Proxy = self
    def getIcon(self):
        return """
            /* XPM */
            static char * rocket_xpm[] = {
            "16 16 43 1",
            " 	c None",
            ".	c #516EB2",
            "+	c #5D79BE",
            "@	c #9BB4FF",
            "#	c #4361A4",
            "$	c #FFFFFF",
            "%	c #ECEDED",
            "&	c #D5D5D5",
            "*	c #C3C3C3",
            "=	c #ACACAC",
            "-	c #E7E6E6",
            ";	c #CFCFCF",
            ">	c #BDBDBE",
            ",	c #A6A7A7",
            "'	c #F9F9F9",
            ")	c #E1E1E1",
            "!	c #C9C8C9",
            "~	c #B7B8B7",
            "{	c #A1A1A0",
            "]	c #F3F3F3",
            "^	c #DADBDB",
            "/	c #C3C4C3",
            "(	c #B2B2B2",
            "_	c #9B9C9B",
            ":	c #EDECED",
            "<	c #D5D5D4",
            "[	c #969595",
            "}	c #E6E7E6",
            "|	c #CECFCE",
            "1	c #BDBDBD",
            "2	c #A6A6A6",
            "3	c #909090",
            "4	c #4C5C8A",
            "5	c #FF0000",
            "6	c #333F62",
            "7	c #FF1F00",
            "8	c #FF7600",
            "9	c #A9A9A9",
            "0	c #FFB200",
            "a	c #B4B4B4",
            "b	c #FFD600",
            "c	c #C7C7C7",
            "d	c #BBBBBB",
            "                ",
            "                ",
            "        .       ",
            "       +..      ",
            "      @..#.     ",
            "      $%&*=     ",
            "      $-;>,     ",
            "      ')!~{     ",
            "      ]^/(_     ",
            "      :<*=[     ",
            "      }|123     ",
            "       456      ",
            "      47876     ",
            "       909      ",
            "       aba      ",
            "      cacdc     "};
         """

class MyClass():
    def __init__(self, name):
        self.Type = 'MyClass'
        # See https://forum.freecadweb.org/viewtopic.php?t=11897 for an alternative using Part::FeaturePython, which has all the things necessary for drawing a shape by default.
        # If you're just positioning sub-elements, an App::DocumentObjectGroupPython provides the folder behaviour by default with its .Group and should be enough.
        obj = App.ActiveDocument.addObject("App::DocumentObjectGroupPython", name)
        MyViewObject(obj.ViewObject)
        # Use App::PropertySubLink and App::PropertySubLinkList to select specific faces for attachment
        obj.addProperty('App::PropertyLink', 'NoseCone', 'Rocket', 'Nose cone')
        obj.addProperty('App::PropertyLink', 'BodyTube', 'Rocket', 'Body tube')
        obj.addProperty('App::PropertyLinkList', 'Fins', 'Rocket', 'List of objects to attach as fins')
        obj.addProperty('App::PropertyLink', 'Exhaust', 'Rocket', 'Hot stuff')
        obj.Proxy = self
    def execute(self, obj):
        # Check if we can proceed
        if (obj.NoseCone is None) or (obj.BodyTube is None) or (obj.Fins is None) or (obj.Exhaust is None):
            raise Exception("Missing parameter, all parts of the rocket must be defined or it won't fly")

        # Remove elements from the folder
        while len(obj.Group) > 0:
            o = obj.Group[-1]
            obj.removeObject(o)
            # If the object was generated on the fly by a previous execute() run, use this to discard it from the document
            #App.ActiveDocument.removeObject(o.Name)

        # Add elements in chosen order, so that they are visually displayed under the folder in the tree
        obj.addObject(obj.NoseCone)
        obj.addObject(obj.BodyTube)
        for fin in obj.Fins:
            obj.addObject(fin)
        obj.addObject(obj.Exhaust)

        print('Do stuff here to position the objects as desired, for example create an Assembly object and put some constraints.')

# Hack from https://forum.freecadweb.org/viewtopic.php?f=22&t=54481
if __name__ == '__main__':
    Gui.doCommand("import MyTest")
    Gui.doCommand("MyTest.MyClass('Rocket')")
Tested on this version, and the attached example .FCStd made with this version too:

Code: Select all

OS: Ubuntu 20.04.1 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23546 (Git) AppImage
Build type: Release
Branch: master
Hash: 6b017f9a16b15b0e628c8d874c4058442dee5548
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United Kingdom (en_GB)
grandcross wrote:
Mon Jan 18, 2021 6:20 pm
But it did occur to me that as an initial problem, writing a macro to import from Open Rocket (and Rocksim) might be useful. You'd still do your design in one of these tools for now, but you could then import the parts for 3D printing, […]
I've started to work on embedding other apps in FreeCAD. My goals are to embed Inkscape, GIMP, Blender since my workflow would often involves these if going through exports and imports wasn't such an annoyance. For now I've managed to embed an external window in FreeCAD's Qt MDI (Multiple Document Interface, i.e. the sub-windows fore each document tab), which works for any window given its window ID (turns out getting that is the hard part), proof of concept screenshot attached in the next post, I've reached the max number of attachments for this one.

At the very least, it would be easy to embed these applications, and double-clicking on a part would export the part to a file, run the app to modify it, and poll for changes (pressing Ctrl+S in the app would trigger an update) and re-import.

Also, a FreeCAD .FCStd document is just a .zip with a different extension, and can include arbitrary files. The "Page" object from the Drawing workbench saves the SVG page template inside the .FCStd to ensure that it may be opened on machines where the original file is absent. This makes it possible to save the other app's native format as a sub-file inside the .FCStd, and do the export-run-poll-import gymnastic mentioned above.

Code: Select all

import PySide
from PySide import QtGui
mdi = Gui.getMainWindow().findChild(QtGui.QMdiArea)
xw = QtGui.QWindow.fromWinId(69206027)
xw.setFlags(QtGui.Qt.FramelessWindowHint)
xwd = QtGui.QWidget.createWindowContainer(xw)
mwx = QtGui.QMainWindow()
mwx.layout().addWidget(xwd)
mdiSub = mdi.addSubWindow(xwd)
mdiSub.show()
Attachments
rocket-built.png
rocket-built.png (101.62 KiB) Viewed 2071 times
rocket-construction.png
rocket-construction.png (155.06 KiB) Viewed 2216 times
rocket.FCStd
(16.1 KiB) Downloaded 15 times
rocket-macro-source-with-icon.zip
(3.22 KiB) Downloaded 17 times
MyTest.py
Place this in ~/.FreeCAD/Macros/MyTest.py
(4.01 KiB) Downloaded 14 times
Last edited by suzanne.soy on Tue Jan 19, 2021 4:27 pm, edited 2 times in total.
:?: Please mark your posts as [solved] :!:
:idea: If the answer you got is a good fit for the wiki, you can edit it!
FreeCAD modelling & coding workbenches+macros: twitch GitHub
suzanne.soy
Posts: 43
Joined: Sat Dec 19, 2020 11:55 pm

Re: [RFC] Rocketry Workbench

Postby suzanne.soy » Tue Jan 19, 2021 2:24 am

suzanne.soy wrote:
Tue Jan 19, 2021 2:22 am
I've started to work on embedding other apps in FreeCAD. My goals are to embed Inkscape, GIMP, Blender since my workflow would often involves these if going through exports and imports wasn't such an annoyance. For now I've managed to embed an external window in FreeCAD's Qt MDI (Multiple Document Interface, i.e. the sub-windows fore each document tab), which works for any window given its window ID (turns out getting that is the hard part), proof of concept screenshot attached in the next post, I've reached the max number of attachments for this one.
Attachments
embedded-Inkscape.png
embedded-Inkscape.png (288.17 KiB) Viewed 2213 times
:?: Please mark your posts as [solved] :!:
:idea: If the answer you got is a good fit for the wiki, you can edit it!
FreeCAD modelling & coding workbenches+macros: twitch GitHub
User avatar
grandcross
Posts: 153
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: [RFC] Rocketry Workbench

Postby grandcross » Tue Jan 19, 2021 3:16 am

Embedding is definitely an interesting concept. It should definitely be given some serious thought.

Playing the skeptic, there are some wrinkles. First up is Open Rocket itself. The project is not as mature as blender, gimp, etc. In fact it's very much at a dead end (my opinion). It's current Java based architecture is proving to be quite the challenge to developers and this is keeping them from providing any meaningful updates. In my opinion, a native FreeCAD implementation would seem a very attractive option but that would require a major pivot by the dev team and I'm certainly not in a position to make that decision for them.A working importer might provide something to show that that would be compelling. If this is a route they choose to go, embedding wouldn't be worth the effort.

The modeling part of OR is fairly straight forward. I think porting that wouldn't be a huge issue. The UI is where the bulk of the work would have to be done.

Components in both products are handled very differently. For example, a nose cone is rarely a cone, and instead of 3 separate fins, it's one set of 3 fins. I'm sure this can be managed, but will require some thought. More so if the model is to be exported in a round trip. I've already started on an importer so I'll have more thoughts on this as I progress. The good news is I think I should have a usable alpha in a week or two. I'll post updates here.

On a positive note, embedding might simplify adding support for the other dominant design tool, Rocksim. Creating an importer for its files should be a smaller incremental task once the Open Rocket importer is complete. I'm designing with this in mind.

Lots to think about.
rebeltaz
Posts: 127
Joined: Wed Apr 03, 2019 5:03 pm

Re: [RFC] Rocketry Workbench

Postby rebeltaz » Tue Jan 19, 2021 7:57 am

I never even knew about Open Rocket. Silly me, I've been designing rockets with pen and graph paper for 30+ years! lol... I would love to see something like this implemented in FreeCAD.
User avatar
grandcross
Posts: 153
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: [RFC] Rocketry Workbench

Postby grandcross » Thu Jan 21, 2021 9:30 am

Well, I have the rudiments of a file parser in place. That was the easy part. I'm now ready to add parts to the model but that's brought me to some way points.

First up, when looking at my nose cone macro, I discovered that I wasn't doing things as well as they could be done. I wrote it when I was new to FreeCAD and documentation was even sparser than it is now. There's still a number of APIs that aren't well documented. It really needs some work. so.... SQUIRREL!!! I'm going to do that before continuing as a lot of the work for it will be directly useful for the importer. The end result will be more complete, full featured, and easier to use. I should have that done in a couple of days depending on life's interruptions.

Secondly, there's the problem of adding multiple parts to a project, such as nose cone, fins, etc. For my own projects, I've taken the lazy man approach of creating new parts and setting the position parameter to place them. This may be the easiest to implement so I may proceed with that one. Alternatively, it would probably be nice to use one of the assembly frameworks. I've not used these at this point so I have some reading and experimentation to do, and that may delay a result. I'll take a quick look, but if it looks like the delay may be significant, I'll take the first approach and refactor for assemblies later.

Also, there seems to be multiple assembly frameworks out there with none of them official. How interchangeable are they? Is there one I should prefer?