MachUpX Installation: Unable to run example codes

84 views
Skip to first unread message

Rahmat Pariyan

unread,
Feb 8, 2023, 4:18:47 PM2/8/23
to MachUp Forum
I'm very excited to explore MachUpX due to its scriptability potential.

I installed python (not anaconda), MachUpX and FreeCAD and tested them. No issues. But when I ran an example script, I get the following error.

C:\Users\rahmat.pariyan\Desktop\Aero\MachUpX\examples\Traditional>python traditional_example.py
Traceback (most recent call last):
  File "C:\Users\rahmat.pariyan\Desktop\Aero\MachUpX\examples\Traditional\traditional_example.py", line 32, in <module>
    my_scene.display_wireframe(show_legend=True)
  File "C:\Users\rahmat.pariyan\AppData\Local\Programs\Python\Python310\lib\site-packages\machupX\scene.py", line 1607, in display_wireframe
    ax = fig.gca(projection='3d')
TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'


The scene object in the script calls the method display_wireframe in scene.py which in turn calls the following

fig = plt.figure(figsize=plt.figaspect(1.0)*2.0)
ax = fig.gca(projection='3d')


which throws the error as gca in figure.py is defined in the class, FigureBase as
def gca(self):

The keyword argument, 'projection' is not included in the definition. Any help to resolve this please?

Cory Goates

unread,
Feb 9, 2023, 12:33:46 PM2/9/23
to MachUp Forum
Have you tried updating matplotlib? That might solve the issue.

Rahmat Pariyan

unread,
Feb 10, 2023, 2:42:51 AM2/10/23
to MachUp Forum
matplotlib is up to date. From my first look, I'm wondering why gca method is called with an argument, "projection" where it is not defined as such in the class, FigureBase. I'll have to look into the details. I'm also not able to run the following

I'm also not able to export the geometry with the following commands
my_scene.export_stl("traditional_airplane.stl")
my_scene.export_dxf()

With the stl export, I get the following error
stl_error.png

And with the dxf export, the following error
dxf_error.png
Perhaps I need to look into the details.

However, I'm able to trim the aircraft and get the forces acting on the airplane and aerodynamic derivatives. That is good.

Rahmat Pariyan

unread,
Feb 10, 2023, 2:57:53 AM2/10/23
to MachUp Forum
By seeing your response to another question, I understand I have incorrectly specified the argument for the stl export. In fact, I was following the MachUpX introduction video at:

I've corrected it as follows but get the same error as dxf export that the geometry has not been defined for airfoil NACA_2410.
my_scene.export_stl(filename = "traditional_airplane.stl")

Cory Goates

unread,
Feb 10, 2023, 11:41:28 AM2/10/23
to MachUp Forum
I'll have to look at the projection issue. That's one thing I don't like about Python. Someone updates their package and makes all your existing code invalid... But such is life.

When you specify the airfoil in your aircraft JSON, you need to tell it what the geometry is. That's all outlined in the docs. You can just tell it it's a NACA 2410, and MachUpX will generate the geometry for you.

Cory Goates

unread,
Feb 13, 2023, 1:47:10 PM2/13/23
to MachUp Forum
As I thought, the display_wireframe() issue was just a depreciation. I've got the fix up on github now.

Rahmat Pariyan

unread,
Feb 13, 2023, 3:12:59 PM2/13/23
to MachUp Forum
Thanks Cory. It's working now. I am also able to export stl and dxf files after including the geometry in the JSON file, as you suggested.

Thanks,
Rahmat

Cory Goates

unread,
Feb 14, 2023, 12:05:29 PM2/14/23
to MachUp Forum
Awesome!
Reply all
Reply to author
Forward
Message has been deleted
0 new messages