Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm using ReferenceArray Class for dimensioning wall with the NewDimension Method.
For the ReferenceArray I want to add only the Start and the End off the wall without the openings.
Please see the relevant part of the code below.
How can I filter only the Start and the End references of the wall?
def isParallel(v1,v2):
return v1.CrossProduct(v2).IsAlmostEqualTo(XYZ(0,0,0))
with rpw.db.Transaction("Wall"):
logger.debug([reference for reference in reference_array])
for wall in wall_selection:
param = wall.LookupParameter('Wall Type').AsString()
if param:
refArray = ReferenceArray()
line = LineElement(wall)
lineDir = line.GetEndPoint(1) - line.GetEndPoint(0)
geoElement = wall.get_Geometry(options)
#get side references
for obj in geoElement:
if isinstance(obj,Solid):
for f in obj.Faces:
try:
faceNormal = f.FaceNormal
if isParallel(faceNormal,lineDir):
refArray.Append(f.Reference)
except Exception, ex:
continue
try:
if dimtype:
dim = doc.Create.NewDimension(doc.ActiveView, line, refArray, dimtype)
else:
dim = doc.Create.NewDimension(doc.ActiveView, line, refArray)
dim.ValueOverride = param;
except Exception, ex:
continue
Thanks,
Yuval
Solved! Go to Solution.