Skip to content

Commit 95b3c72

Browse files
committed
fix error on command line input data from active command
1 parent 90d9e49 commit 95b3c72

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

Oldstuff/OldGeneric/arc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ def throughAngle(self, angle):
346346
return _val
347347

348348
def getEndpoints(self):
349-
"""Return where the two endpoints for the arc-segment lie.
349+
"""Return where the two end points for the arc-segment lie.
350350
351-
getEndpoints(self)
352-
353-
This function returns two tuples, each containing the x-y coordinates
354-
of the arc endpoints. The first tuple corresponds to the endpoint at
355-
the start_angle, the second to the endpoint at the end_angle.
351+
getEndpoints(self)
352+
353+
This function returns two tuples, each containing the x-y coordinates
354+
of the arc end points. The first tuple corresponds to the end point at
355+
the start_angle, the second to the end point at the end_angle.
356356
"""
357357
_cx, _cy = self.__center.getCoords()
358358
_r = self.__radius

PythonCAD/Generic/Kernel/GeoEntity/arc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def getProjection(self,fromPoint):
254254
return pj1 # ######################## adding return value for pj2
255255
else:
256256
return None
257+
257258
def GetTangentPoint(self,x,y,outx,outy):
258259
"""
259260
Get the tangent from an axternal point
@@ -454,7 +455,7 @@ def __str__(self):
454455
str(self.center), str(self.radius), str(self.startAngle), str(self.endAngle))
455456
return msg
456457

457-
def test_angle(s, e, a):
458+
def test_angle(self,s, e, a):
458459
"""
459460
Returns if an angle lies between the start and end angle of an arc.
460461
s: arc start angle

PythonCAD/Generic/Kernel/GeoEntity/geometricalentity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GeometricalEntity(dict):
3232
"""
3333
def __init__(self, kw, argNameType):
3434
"""
35-
argv name must be created befor init the base class
35+
argv name must be created before init the base class
3636
"""
3737
if kw is None and argNameType is None:
3838
return

PythonCAD/Interface/Command/icommand.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,26 @@ def addTextEvent(self, value):
164164
"""
165165
compute imput from text
166166
"""
167-
if value=="":
167+
if str(value)=="":
168168
self.kernelCommand.applyDefault()
169169
self.applyCommand()
170170
return
171-
elif value.upper()=="UNDO":
171+
elif str(value).upper()=="UNDO":
172172
#TODO: perform a back operation to the command
173173
return
174-
elif value.upper()=="REDO":
174+
elif str(value).upper()=="REDO":
175175
#TODO: perform a forward operation to the command
176176
return
177177
else:
178178
try:
179-
tValue=self.decodeText(value)
179+
tValue=self.decodeText(str(value))
180180
self.addMauseEvent(tValue[0], tValue[1], tValue[2], tValue[3], tValue[4], correct=None)
181181
except PyCadWrongImputData, msg:
182182
print "Problem on ICommand.addTextEvent"
183183
self.updateInput(msg)
184184
self.updateInput(self.kernelCommand.activeMessage)
185185
return
186+
186187
def applyDefault(self):
187188
"""
188189
apply the default value command
@@ -297,18 +298,24 @@ def decodeText(self, value):
297298
entitys=None
298299
text=None
299300
angle=None
301+
value=str(value)
302+
303+
def niceReturn():
304+
return (point,entitys, distance,angle, text)
300305
try:
301306
try:
302307
raise self.kernelCommand.activeException()(None)
303308
except ExcPoint:
304309
if value.find(',')>-1: # ABSOLUTE CARTESIAN INPUT
305310
x, y=value.split(',')
306311
point=Point(convertLengh(x), convertLengh(y))
312+
return niceReturn()
307313
elif value.find(';')>-1: # RELATIVE CARTESIAN INPUT
308314
x, y=value.split(';')
309315
x=self.scene.fromPoint.getx()+convertLengh(x)
310316
y=self.scene.fromPoint.gety()+convertLengh(y)
311317
point=Point(x, y)
318+
return niceReturn()
312319
elif value.find('>')>-1:
313320
ang, distance=value.split('>')
314321
ang=convertAngle(ang)
@@ -318,6 +325,7 @@ def decodeText(self, value):
318325
x=self.scene.fromPoint.getx()+float(x)
319326
y=self.scene.fromPoint.gety()+float(y)
320327
point=Point(x, y)
328+
return niceReturn()
321329
else: # DISTANCE+ANGLE FROM SCENE set coordinate based on distance input and angle from mouse position on the scene
322330
d=float(value)
323331
pX=self.scene.mouseOnSceneX
@@ -333,24 +341,29 @@ def decodeText(self, value):
333341
x=self.scene.fromPoint.getx()+d*math.cos(a)
334342
y=self.scene.fromPoint.gety()+d*math.sin(a)
335343
point=Point(x, y)
344+
return niceReturn()
336345
except (ExcEntity,ExcMultiEntity):
337346
entitys=self.getIdsString(value)
347+
return niceReturn()
338348
except ExcEntityPoint:
339349
#(4@10,20)
340350
id, p=value.split('@')
341351
x, y=p.split(',')
342352
point=Point(float(x), float(y))
343353
entitys=self.getIdsString(id)
344-
return
354+
return niceReturn()
345355
except (ExcLenght, ExcInt, ExcBool):
346356
distance=value
357+
return niceReturn()
347358
except(ExcAngle):
348359
angle=value
360+
return niceReturn()
349361
except(ExcText):
350362
text=value
363+
return niceReturn()
351364
except:
352365
raise PyCadWrongImputData("BaseCommand : Wrong imput parameter for the command")
353-
return (point,entitys, distance,angle, text)
366+
return niceReturn()
354367

355368
def getIdsString(self, value):
356369
"""

0 commit comments

Comments
 (0)