Skip to content

Commit 4a8f33f

Browse files
committed
freecad: rename cells -> num_cells
1 parent 45661cf commit 4a8f33f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

freecad/freecad_glider/tools/glider.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def __init__(self, obj):
137137
'aspect_ratio', 'gliderdata',
138138
'aspect ratio of glider', 1)
139139
obj.addProperty('App::PropertyInteger',
140-
'cells', 'gliderdata',
140+
'num_cells', 'gliderdata',
141141
'number of cells', 1)
142142
obj.addProperty('App::PropertyFloat',
143143
'span', 'gliderdata',
@@ -151,16 +151,17 @@ def addProperties(self):
151151
pass
152152

153153
def execute(self, obj):
154+
glider_instance = obj.Proxy.getGliderInstance() # caching
154155
if hasattr(obj, "area"):
155-
obj.area = obj.Proxy.getGliderInstance().area
156+
obj.area = glider_instance.area
156157
if hasattr(obj, "projected_area"):
157-
obj.projected_area = obj.Proxy.getGliderInstance().projected_area
158+
obj.projected_area = glider_instance.projected_area
158159
if hasattr(obj, "area"):
159-
obj.aspect_ratio = obj.Proxy.getGliderInstance().aspect_ratio
160+
obj.aspect_ratio = glider_instance.aspect_ratio
160161
if hasattr(obj, "span"):
161-
obj.span = obj.Proxy.getGliderInstance().span
162-
if hasattr(obj, "cells"):
163-
obj.cells = len(obj.Proxy.getGliderInstance().cells)
162+
obj.span = glider_instance.span
163+
if hasattr(obj, "num_cells"):
164+
obj.num_cells = len(glider_instance.cells)
164165

165166
def addProperty(self, name, value, group, docs, p_type=None):
166167
addProperty(self.obj, name, value, group, docs, p_type)

0 commit comments

Comments
 (0)