@@ -162,14 +162,16 @@ def __init__(self,dotted=False,scolor=None,swidth=None,ontop=False):
162
162
def p1 (self ,point = None ):
163
163
"sets or gets the first point of the line"
164
164
if point :
165
- self .coords .point .set1Value (0 ,point .x ,point .y ,point .z )
165
+ if self .coords .point .getValues ()[0 ].getValue () != tuple (point ):
166
+ self .coords .point .set1Value (0 ,point .x ,point .y ,point .z )
166
167
else :
167
168
return Vector (self .coords .point .getValues ()[0 ].getValue ())
168
169
169
170
def p2 (self ,point = None ):
170
171
"sets or gets the second point of the line"
171
172
if point :
172
- self .coords .point .set1Value (1 ,point .x ,point .y ,point .z )
173
+ if self .coords .point .getValues ()[- 1 ].getValue () != tuple (point ):
174
+ self .coords .point .set1Value (1 ,point .x ,point .y ,point .z )
173
175
else :
174
176
return Vector (self .coords .point .getValues ()[- 1 ].getValue ())
175
177
@@ -796,6 +798,7 @@ def __init__(self):
796
798
mat3 .diffuseColor .setValue (col )
797
799
self .coords3 = coin .SoCoordinate3 ()
798
800
self .lines3 = coin .SoLineSet ()
801
+ self .pts = []
799
802
s = coin .SoSeparator ()
800
803
s .addChild (pick )
801
804
s .addChild (self .trans )
@@ -832,24 +835,26 @@ def update(self):
832
835
else :
833
836
pts .extend ([[- bound ,curr ,z ],[bound ,curr ,z ]])
834
837
pts .extend ([[curr ,- bound ,z ],[curr ,bound ,z ]])
835
- idx = []
836
- midx = []
837
- aidx = []
838
- for p in range (0 ,len (pts ),2 ):
839
- idx .append (2 )
840
- for mp in range (0 ,len (mpts ),2 ):
841
- midx .append (2 )
842
- for ap in range (0 ,len (apts ),2 ):
843
- aidx .append (2 )
844
- self .lines1 .numVertices .deleteValues (0 )
845
- self .lines2 .numVertices .deleteValues (0 )
846
- self .lines3 .numVertices .deleteValues (0 )
847
- self .coords1 .point .setValues (pts )
848
- self .lines1 .numVertices .setValues (idx )
849
- self .coords2 .point .setValues (mpts )
850
- self .lines2 .numVertices .setValues (midx )
851
- self .coords3 .point .setValues (apts )
852
- self .lines3 .numVertices .setValues (aidx )
838
+ if pts != self .pts :
839
+ idx = []
840
+ midx = []
841
+ aidx = []
842
+ for p in range (0 ,len (pts ),2 ):
843
+ idx .append (2 )
844
+ for mp in range (0 ,len (mpts ),2 ):
845
+ midx .append (2 )
846
+ for ap in range (0 ,len (apts ),2 ):
847
+ aidx .append (2 )
848
+ self .lines1 .numVertices .deleteValues (0 )
849
+ self .lines2 .numVertices .deleteValues (0 )
850
+ self .lines3 .numVertices .deleteValues (0 )
851
+ self .coords1 .point .setValues (pts )
852
+ self .lines1 .numVertices .setValues (idx )
853
+ self .coords2 .point .setValues (mpts )
854
+ self .lines2 .numVertices .setValues (midx )
855
+ self .coords3 .point .setValues (apts )
856
+ self .lines3 .numVertices .setValues (aidx )
857
+ self .pts = pts
853
858
854
859
def setSize (self ,size ):
855
860
self .numlines = size
0 commit comments