Hi Steve
With the wip V6 i have problems with pyton scripts.
In the attached images the script ViteBrugola3.py load the script Dynamic_Copy_2_rs .
When i start ViteBrugola3 i get the message:
Message: No module named Dynamic_Copy_2_rs
In V5 all are OK.
The Python editor option i have the same setting
Ciao Vittorio
Traceback:
line 7, in , “C:\Users\Angela\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\ViteBrugola3.py”
Hi Steve
The problem is because the boolean difference fail and i get the below message error.
In V5 the script is Ok , the tollerance is the same that V5. I attached a 3dm file with objects that fail the boolean difference.
Message: ‘NoneType’ object is unsubscriptable
Traceback:
line 91, in VB, “C:\Users\Angela\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\ViteBrugola3.py”
line 112, in , “C:\Users\Angela\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\ViteBrugola3.py”
Hi Steve
I have another request:. I want to select only the red curve and not the edge like the attached image.
how should I modify the attached script?import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def GetCurve():
"""
Return list of curve and edge
"""
. filter= Rhino.DocObjects.ObjectType.Curve
rc, objrefs = Rhino.Input.RhinoGet.GetOneObject("Seleziona punto vicino allo spigolo", False, filter)
crv=objrefs.Curve()
print crv
len=rs.CurveLength(crv)
lun=len/4
GetCurve()
i´ve first thought this can be done using Rhino.Input.Custom.GeometryAttributeFilter but there was no way to filter by object color with it. This seems to be easier, MyFilter() sets the object type and r,g,b value:
import rhinoscriptsyntax as rs
def TestGetRedCrv():
allowed_objs = MyFilter(objtype=4, r=255, g=0, b=0)
if not allowed_objs: return
go_ex = rs.GetObjectEx("Select", 0, False, True, allowed_objs)
if go_ex:
print go_ex[0]
def MyFilter(objtype=4, r=255, g=0, b=0):
objs = rs.ObjectsByType(objtype, False, 1)
if objs is not None:
allowed = []
for o in objs:
color = rs.ObjectColor(o)
if color:
if color.R == r and color.G == g and color.B == b:
allowed.append(o)
if len(allowed) == 0: return None
return allowed
if __name__=="__main__":
TestGetRedCrv()
EDIT: it also works identical using rs.GetObject() instead of rs.GetObjectEx()