Exemplo n.º 1
0
def make_airfoil(fn=None):
    obj = app.ActiveDocument.addObject("Part::FeaturePython", "airfoil")
    airfoil_proxies.AirfoilProxy(obj, fn)
    airfoil_view_proxies.ViewProviderAirfoil(obj.ViewObject)
    obj.Label = obj.Proxy.get_name(obj)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 2
0
def make_vandevooren(tau=0.05, epsilon=0.05, numpoints=50):
    obj = app.ActiveDocument.addObject("Part::FeaturePython",
                                       "vandavooren-airfoil")
    airfoil_proxies.VandevoorenProxy(obj, tau, epsilon, numpoints)
    airfoil_view_proxies.ViewProviderAirfoil(obj.ViewObject)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 3
0
def make_joukowsky(midpoint=-0.1 + 0.1j, numpoints=50):
    obj = app.ActiveDocument.addObject("Part::FeaturePython",
                                       "jukowsky-airfoil")
    airfoil_proxies.JoukowskyProxy(obj, midpoint, numpoints)
    airfoil_view_proxies.ViewProviderAirfoil(obj.ViewObject)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 4
0
def make_trefftz(midpoint=-0.1 + 0.1j, tau: float = 0.05, numpoints: int = 50):
    obj = app.ActiveDocument.addObject("Part::FeaturePython",
                                       "trefftz-airfoil")
    airfoil_proxies.TrefftzProxy(obj, midpoint, tau, numpoints)
    airfoil_view_proxies.ViewProviderAirfoil(obj.ViewObject)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 5
0
 def accept(self):
     self.scene -= self.task_separator
     self.set_parafoil_from_current()
     app.activeDocument().recompute()
     self.obj.ViewObject.show()
     gui.SendMsgToActiveView("ViewFit")
     gui.Control.closeDialog()
Exemplo n.º 6
0
 def xfoil_foo(airfoil, cl_input, re):
     from airfoil import XfoilCase
     app.activeDocument().recompute()
     gui.updateGui()
     case = XfoilCase(airfoil)
     params = XfoilCase.default_params
     params["re"] = re
     params["cl_input"] = cl_input
     response = case.compute_coefficients(params)
     print(response)
     return response["cd"], response["cm"]
Exemplo n.º 7
0
def calibrate_parafoil(calibrate_x=False,
                       calibrate_y=True,
                       calibrate_w=False,
                       parafoil=None,
                       airfoil=None):
    if not all([bool(parafoil), bool(airfoil)]):
        selection = gui.Selection.getSelection()
        assert len(selection) == 2
        parafoil = selection[0]
        airfoil = selection[1]
    assert isinstance(parafoil.Proxy, airfoil_proxies.ParafoilProxy)
    assert isinstance(airfoil.Proxy, airfoil_proxies.AirfoilProxy)
    parafoil.Proxy.calibrate(parafoil, airfoil.Proxy.get_airfoil(airfoil),
                             calibrate_x, calibrate_y, calibrate_w)
    app.activeDocument().recompute()
Exemplo n.º 8
0
    def _calibrate(self):
        from freecad.airfoil import commands
        selection = gui.Selection.getSelection()
        assert len(selection) == 1
        other_foil = selection[0]
        upper_array_temp = self.obj.upper_array
        lower_array_temp = self.obj.lower_array
        self.set_parafoil_from_current()

        if self.q_calibrate_x.isChecked() or self.q_calibrate_y.isChecked(
        ) or self.q_calibrate_w.isChecked():
            commands.calibrate_parafoil(self.q_calibrate_x.isChecked(),
                                        self.q_calibrate_y.isChecked(),
                                        self.q_calibrate_w.isChecked(),
                                        self.obj, other_foil)

        # set the poles of the coin bspline
        self.setup_bspline()

        # reset the poles of the freecad object (parafoil)
        self.obj.upper_array = upper_array_temp
        self.obj.lower_array = lower_array_temp
        app.activeDocument().recompute()
Exemplo n.º 9
0
def make_parafoil():
    obj = app.ActiveDocument.addObject("Part::FeaturePython", "parafoil")
    airfoil_proxies.ParafoilProxy(obj)
    airfoil_view_proxies.ViewProviderParafoil(obj.ViewObject)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 10
0
def make_naca(naca_digits="2412", numpoints=50):
    obj = app.ActiveDocument.addObject("Part::FeaturePython", "naca-airfoil")
    airfoil_proxies.NacaProxy(obj, naca_digits, numpoints)
    airfoil_view_proxies.ViewProviderAirfoil(obj.ViewObject)
    app.activeDocument().recompute()
    return obj
Exemplo n.º 11
0
 def IsActive(self):
     return bool(app.activeDocument())
Exemplo n.º 12
0
 def airfoil_from_parafoil(self, parafoil):
     obj = app.ActiveDocument.addObject("Part::FeaturePython", "airfoil")
     airfoil_proxies.LinkedAirfoilProxy(obj, parafoil)
     ViewProviderAirfoil(obj.ViewObject)
     # obj.Label = obj.Proxy.get_name(obj)
     app.activeDocument().recompute()