Cut plane Knife tool does not work on 2.28

https://blenderartists.org/forum/viewtopic.php?t=7830

That tool does not work on OSX 2.28 . Any clues ?

Using a clean Global Dictionary.
Run Python script “knife.py” …
KNIFE TOOL - © Dec. 2002 Stefano <S68> Selleri
Vers. 0.0.3 - Released under Blender Artistic License (www.blender.org)
In Object_GetSelected()

OK: Active object is a single face plane -> Getting Cut Data

Traceback (most recent call last):
File “knife.py”, line 412, in bevent
File “knife.py”, line 323, in DoTheCut
File “knife.py”, line 106, in CutData
File “/sw/lib/python2.2/warnings.py”, line 38, in warn
filename = sys.argv[0]
AttributeError: ‘module’ object has no attribute ‘argv’

The sys.argv problem is a known problem. I think that should be solve in the next release.

but you can fix it anyway, just add this code at the start of the script (not tested, but should work):


import sys
sys.argv = [""]

Martin

Ok that makes it work just a bit buggy.

The bug is that it creates the new mesh elsewhere.
And the gui reverts to the code. Can you fix those parts ?

1/ replace all the getSelected() by GetSelected()

2/ at line 358, replace the lines:


	# Li posiziona dove devono stare
	ObPos.loc = tuple(Obj.loc)
	ObPos.rot = tuple(Obj.rot)
	ObPos.size = tuple(Obj.size)
	ObNeg.loc = tuple(Obj.loc)
	ObNeg.rot = tuple(Obj.rot)
	ObNeg.size = tuple(Obj.size)


by

  	# Li posiziona dove devono stare
		ObPos.LocX, ObPos.LocY, ObPos.LocZ = Obj.LocX,Obj.LocY,Obj.LocZ
		ObPos.RotX,ObPos.RotY,ObPos.RotZ = Obj.RotX,Obj.RotY,Obj.RotZ
		ObPos.SizeX,ObPos.SizeY,ObPos.SizeZ = Obj.SizeX,Obj.SizeY,Obj.SizeZ
		ObNeg.LocX, ObNeg.LocY,ObNeg.LocZ= Obj.LocX,Obj.LocY,Obj.LocZ
		ObNeg.RotX, ObNeg.RotY, ObNeg.RotZ= Obj.RotX,Obj.RotY,Obj.RotZ
		ObNeg.SizeX,ObNeg.SizeY,ObNeg.SizeZ = Obj.SizeX,Obj.SizeY,Obj.SizeZ

( the modified script )

Awsome ! Thankyou all.

Now if it could use a plane with more than one face. But that is just asking for to much :wink:

^v^

It will probably not be a plane if it has more than one face. Heck, even one face (a quad) is sometimes not a plane.

Martin

btw. I had to delete the else: (it would be possible to correct it, but Im just too tired :slight_smile: ) -> whitelie

  else:
  	msg = "ERROR: active object has no face"