bugpyFormex - Bugs: bug #48240, pick('points') raise error with 2...

 
 

bug #48240: pick('points') raise error with 2 actors, if color and bkcolor are given

Submitted by:  gianluca de santis <gianlucadesi>
Submitted on:  Thu 16 Jun 2016 11:15:18 AM UTC  
 
Category: GUISeverity: 4 - Important
Item Group: Functionality errorStatus: Fixed
Privacy: PublicAssigned to: Benedict Verhegghe <bverheg>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 16 Jun 2016 06:04:46 PM UTC, comment #3:

This is fixed in commit 7e8cf6cf3
by making the comparison operator for Actors do A is B.

This likely also solves the mentioned problem in ItemList.delete.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Thu 16 Jun 2016 04:04:43 PM UTC, comment #2:

It is even more bizarre if one considers that a list of class instances is really implemented as a list (C array) of the object ids.

It looks like something is changing the builtin meaning of "item in list". I guess it is caused by some "from numpy import *", overriding the builtin with something that can work on numpy arrays.

A good reason to try to avoid all 'import *'.

Maybe we should get used to 'import numpy as np' and add a np. everywhere. I know: it's a lot of work and makes the scripting in pyFormex more tedious.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Thu 16 Jun 2016 03:48:26 PM UTC, comment #1:

This is a bizarre error.

a is an Actor, and pickable is a list of Actors. Then
print(a.__class__)
print(pickable.__class__)
gives:
<class 'pyformex.opengl.drawable.Actor'>
<type 'list'>

But
a in pickable
returns a numpy error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

We can work around the problem by using a try and list.index(a),
or by creating a list of id(Actor) instead of a list of Actor itself. The latter solution was already implemented in class
scene.ItemList (in the delete method), where we encountered the same problem (it occasionally occurs!).

We should investigate this problem further.
It is strange that a list of class instances occasionally does not work properly.

In this case of the picking, I think the problem did not exist some time ago.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Thu 16 Jun 2016 11:15:18 AM UTC, original submission:

If you draw 2 objects with color and bkcolor the pick('points') does not work (both by script or by GUI)

Try:

clear()
s = Mesh(eltype='tri3')
s1 = s.trl([2.,2.,2.])
draw(s,color='red',bkcolor='green')
draw(s1,color='orange',bkcolor='cyan')
"""you can use Tools / Pick / Points and when picking it raise an error"""
## p = pick('point')

gianluca de santis <gianlucadesi>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bverheg (Posted a comment)
  • -unavailable- added by gianlucadesi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 16 Jun 2016 06:04:46 PM UTCbverhegItem GroupNone=>Functionality error
      StatusNone=>Fixed
      Assigned toNone=>bverheg
      Open/ClosedOpen=>Closed
    Thu 16 Jun 2016 03:48:26 PM UTCbverhegSeverity3 - Normal=>4 - Important

    Back to the top


    Powered by Savane 3.1-cleanup1