def Rendering(obj): display, start_display, add_menu, add_function_to_menu = init_display() # Printing the variables from the aircraft object... # attrs = vars(aircraft) # pprint.pprint(attrs,width=1) #------------- WING -------------------- # Add NACA 4 digit airfoils to loft between: x0 = float(obj.geo['Kink_wing']['x'][0]) y0 = float(obj.geo['Kink_wing']['y'][0]) z0 = 0.0 c0 = float(obj.geo['Kink_wing']['chords'][0]) # z0 = obj.geo['Kink_wing']['zu'][0] x1 = float(obj.geo['Kink_wing']['x'][1]) y1 = float(obj.geo['Kink_wing']['y'][1]) z1 = 0.0 c1 = float(obj.geo['Kink_wing']['chords'][1]) # x2 = float(obj.geo['Kink_wing']['x'][2]) y2 = float(obj.geo['Kink_wing']['y'][2]) z2 = 0.0 c2 = float(obj.geo['Kink_wing']['chords'][2]) # x3 = float(obj.geo['Kink_wing']['x'][3]) y3 = float(obj.geo['Kink_wing']['y'][3]) z3 = 0.0 c3 = float(obj.geo['Kink_wing']['chords'][3]) # Profiles... Af0 = airconics.primitives.Airfoil([x0, y0, z0], ChordLength=c0, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af0.Curve, update=True, color='GREEN') Af1 = airconics.primitives.Airfoil([x1, y1, z1], ChordLength=c1, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af1.Curve, update=True, color='GREEN') Af2 = airconics.primitives.Airfoil([x2, y2, z2], ChordLength=c2, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af2.Curve, update=True, color='GREEN') Af3 = airconics.primitives.Airfoil([x3, y3, z3], ChordLength=c3, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af3.Curve, update=True, color='GREEN') surf_wingin = act.AddSurfaceLoft([Af0, Af1, Af2]) surf_wingout = act.AddSurfaceLoft([Af2, Af3]) #------------- HT -------------------- # Add NACA 4 digit airfoils to loft between: x0 = float(obj.geo['horz']['x'][0]) y0 = float(obj.geo['horz']['y'][0]) z0 = 0.0 c0 = float(obj.geo['horz']['chords'][0]) # z0 = obj.geo['Kink_wing']['zu'][0] x1 = float(obj.geo['horz']['x'][1]) y1 = float(obj.geo['horz']['y'][1]) z1 = 0.0 c1 = float(obj.geo['horz']['chords'][1]) x2 = float(obj.geo['horz']['x'][2]) y2 = float(obj.geo['horz']['y'][2]) z2 = 0.0 c2 = float(obj.geo['horz']['chords'][2]) # Profiles... Af0 = airconics.primitives.Airfoil([x0, y0, z0], ChordLength=c0, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af0.Curve, update=True, color='GREEN') Af1 = airconics.primitives.Airfoil([x1, y1, z1], ChordLength=c1, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af1.Curve, update=True, color='GREEN') Af2 = airconics.primitives.Airfoil([x2, y2, z2], ChordLength=c2, Rotation=0, Twist=0, Naca4Profile='0012') display.DisplayShape(Af2.Curve, update=True, color='GREEN') surf_HT = act.AddSurfaceLoft([Af0, Af1, Af2]) #------------- VT -------------------- # Add NACA 4 digit airfoils to loft between: # x0 = float(obj.geo['vert']['x'][0]) # y0 = 0.0 # z0 = float(obj.geo['vert']['z'][0]) x0 = float(obj.geo['vert']['x'][0]) y0 = 0.0 z0 = 1.0 c0 = float(obj.geo['vert']['chords'][0]) # z0 = obj.geo['Kink_wing']['zu'][0] #x1 = float(obj.geo['vert']['x'][1]) #y1 = 0.0 # z1 = float(obj.geo['vert']['z'][0]) x1 = float(obj.geo['vert']['x'][1]) y0 = 0.0 z1 = 5.5 c1 = float(obj.geo['vert']['chords'][1]) # Profiles... Af0 = airconics.primitives.Airfoil([x0, y0, z0], ChordLength=c0, Rotation=90, Twist=0, Naca4Profile='0012') display.DisplayShape(Af0.Curve, update=True, color='GREEN') Af1 = airconics.primitives.Airfoil([x1, y1, z1], ChordLength=c1, Rotation=90, Twist=0, Naca4Profile='0012') display.DisplayShape(Af1.Curve, update=True, color='GREEN') surf_VT = act.AddSurfaceLoft([Af0, Af1]) #------------- FUSELAGE -------------------- ## # fus = fuselage_oml.Fuselage(NoseLengthRatio=0.182, # TailLengthRatio=0.293, # Scaling=[55.902, 55.902, 55.902], # NoseCoordinates=[0.0, 0.0, 0], # CylindricalMidSection=False, # SimplificationReqd=False, # Maxi_attempt=5, # construct_geometry=True) # Current Display of the WHTVT display.DisplayShape(surf_wingin, update=True) display.DisplayShape(surf_wingout, update=True) display.DisplayShape(surf_HT, update=True) display.DisplayShape(surf_VT, update=True) #display.DisplayShape(fus, update=True) # fus.Display() start_display()
""" if __name__ == "__main__": import airconics import airconics.AirCONICStools as act # Initialise the display from OCC.Display.SimpleGui import init_display display, start_display, add_menu, add_function_to_menu = init_display() # Add NACA 4 digit airfoils to loft between: Af2 = airconics.primitives.Airfoil([0., 0., 0.], ChordLength=3., Naca4Profile='2412') display.DisplayShape(Af2.Curve, update=True, color='GREEN') Af3 = airconics.primitives.Airfoil([0., 5., 0.], ChordLength=1., Naca4Profile='0012') display.DisplayShape(Af3.Curve, update=True, color='GREEN') Af4 = airconics.primitives.Airfoil([0., 6., 0.2], ChordLength=0.2, Naca4Profile='0012') display.DisplayShape(Af4.Curve, update=True, color='GREEN') surf = act.AddSurfaceLoft([Af2, Af3, Af4]) # Note that surf is a TOPO_DS Shape, and hence no surf.Shape is required for display display.DisplayShape(surf, update=True) start_display()