sc.doc.Objects.FindByCrossingWindowRegion
doesn’t seem to work on blocks ;/
Hi @Daniel_Krajnik,
below seems to work, i have 2 blocks in the region and active top view:
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
def DoSomething():
vp = scriptcontext.doc.Views.ActiveView.ActiveViewport
p0 = Rhino.Geometry.Point3d(-10000, -10000, 0)
p1 = Rhino.Geometry.Point3d( 10000, 10000, 0)
f = Rhino.DocObjects.ObjectType.InstanceReference
rc = sc.doc.Objects.FindByCrossingWindowRegion(vp, [p0, p1], True, f)
if rc:
print "Found {} blocks in region".format(rc.Count)
rs.SelectObjects(rc)
DoSomething()
Can you post an example where it fails ?
_
c.
1 Like
@clement you are right, the FindByCrossingWindowRegion
method works fine - it correctly detects the Block Instances. The problem for me was in the Make2D step, which didn’t process correctly these block instances - they just didn’t appear. Upon further inspection it was clear that blocks were correctly detected, but failed to go through the Compute
method of the HiddenLineDrawing
.
Sorry for the confusion and thanks for the help again.
OK, happy coding
_
c.
1 Like