python error and solution for megabool in 2.42

Shaba1 asked me about the error the other day and I just ran into it again so here it is.

Apparently blender 2.42 doesn’t like Vector /= Number

So in stead you want to do Vector *= 1.0/Number

In the megabool script you’ll have to change 2 lines to make it work.

At line nr 1217 change,

self.center/=len(self.v)

into

self.center*=1.0/len(self.v)

and at line nr 366 change,

vsum=(dA+dB)/2

into

vsum=(dA+dB)*0.5

Cambo had a look and it should be fixed in cvs… in the meantime this should fix it.

Just mailed Gilbert and he removed it because its mathamaticly incorrect to have vec/float,
I thaught it was a mistake and added it back.

will need to discuss on the ML or here if anyone wants.

my opinnie is that though its not math correct its usefull enough and some other API’s allow it… why not keep it in.

Thanks I will try this when I get home to see if it worked

Actually macuno I was running the program under 2.41a but got the same error when I ran it under 2.42

Ok I added those corrections and now the script that uses megabool works as it should. Though the blocks that it cuts are offset from the center of the blender world axis center. I think that may be a problem of the calling script though. Thanks macouno. I REALLY needed this script to work.

if K is a scalar, then V*(1/K) is the same as V/K for K != 0; so it is in fact mathematically correct. Perhaps there was some miscommunication?

He might have meant that given vectors V1 and V2, V1/V2 is undefined.

LetterRip

LetterRip, nope he was quite clear that vec/float was incorrect mathamaticaly.

even tho he’s right, Its obvious what the intention is when you see vec/float and vec * (1/float) as a pain, how do we come to a docision on this?

removing without depricating was a bit rash (Joseph admitted), a deprication warning wuold have been better.

Yeah I have to agree… in this case practicality outweighs “correctness”, I don’t know of any other way to interpret vec/float.

Some scripts I use broke at 2.38 (and tuhopuu3).

I substituted
Vector/Number

with
for v in Vec: v /= number

It worked for some.

Im going to add in support for *=, /=, += and -=, this is more efficient because it dosnt create a new vector. - rather modifys the old one in place.

In the script I got both of macouno’s changes are commented out. Does it mean it’s an updated version? Can someone upload the newly modified script to test it out? :wink:

cheers,
Alvaro

I tried the RoomConstructor script with a much more complex floor plan. Now I have gotten another error with megabool.

Traceback (most recent call last):
  File "<string>", line 511, in blenderTest1
  File "<string>", line 74, in getFinalBlenderModel
  File "<string>", line 256, in getFinalBlenderModel
  File "C:\Program Files\Blender Foundation\Blender241\.blender\scripts\megabool_r12.py", line 1949,
 in Difference
    FullIntersect(bCookie,bCutter)
  File "C:\Program Files\Blender Foundation\Blender241\.blender\scripts\megabool_r12.py", line 1872,
 in FullIntersect
    IntersectEdgeFace(eB,fA)
  File "C:\Program Files\Blender Foundation\Blender241\.blender\scripts\megabool_r12.py", line 1789,
 in IntersectEdgeFace
    if TestBounds(e.bb,f.bb):
AttributeError: 'list' object has no attribute 'bb'

I have no ideal what this means

Shaba1, I expect f.bb is supposed to relate to something in a face… that would lead me to expect that you perhaps have an edge somewhere that isn’t connected to a face… so TestBounds() gets something from an edge, but not a related face… I’d say… check your model… there’s a mesh checker online at my site ( http://alienhelpdesk.com/index.php?id=33 )… written for BRayBaker, but I’d run that on your model… see if it finds any loose verts or edges.

that might be right I. I did a quick plane view in StageConstruction.py Just to try something out. I might have not connected all the walls. If you have jython macauno I can send you both StageConstructor.py,BlenderRoomConstructor.py and my .room file for you to test out.

Sorry… no time for any testing right now… try again in 3 weeks :wink: