Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Apart from the fact that I don't know how to code very well, you'll realize that by reading the code.
Why doesn't the Outline class return the correct line?
The four points of the face are normally on the same line (two quadrants don't work well).
If anyone has an explanation, I'd appreciate it.
public List<XYZ> findp(Face f)
{
List<XYZ> lpts=new List<XYZ>();
var clt=f.GetEdgesAsCurveLoops();
foreach (CurveLoop cl in clt)
{
foreach (Curve c in cl)
{
lpts.Add(c.GetEndPoint(0));
}
}
return lpts;
}
public void cline()
{
Document doc=this.Document;
UIDocument uidoc=Application.ActiveUIDocument;
//choix du mur
Selection choix = uidoc.Selection;
Reference choixselection = choix.PickObject(ObjectType.Element);
Wall w=doc.GetElement(choixselection) as Wall;
IList<Reference> refext=HostObjectUtils.GetSideFaces(w,ShellLayerType.Exterior);
Face fext=w.GetGeometryObjectFromReference(refext[0]) as Face;
XYZ pdeb=findp(fext)[0];
XYZ pfin=findp(fext)[3];
Outline ol=new Outline(pdeb,pfin);
ol.AddPoint(findp(fext)[1]);
ol.AddPoint(findp(fext)[2]);
Line l=Line.CreateBound(ol.MinimumPoint,new XYZ(ol.MaximumPoint.X,ol.MaximumPoint.Y,ol.MinimumPoint.Z));
Transaction t = new Transaction(doc,"create a grid align on face wall");
t.Start();
Grid lineGrid = Grid.Create(doc, l);
t.Commit();
}
Christian.stan
Solved! Go to Solution.