Skip to content

Commit

Permalink
creation of workplane-based, level-bound fix part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelbaran authored and Fraser Greenroyd committed Jun 21, 2023
1 parent 0ce616f commit 0a03dae
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Revit_Core_Engine/Create/FamilyInstance/FamilyInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,26 @@ private static FamilyInstance FamilyInstance_WorkPlaneBased(Document document, F
{
if (host != null)
{
XYZ location;
Reference reference;
bool closest;

RevitLinkInstance linkInstance = null;
if (document.PathName != host.Document.PathName)
linkInstance = document.LinkInstance(host.Document.Title);

XYZ location = host.ClosestPointOn(origin, out reference, out closest, orientation?.BasisZ, linkInstance, settings);
if (location == null || reference == null)
return null;
if (host is Level)
{
location = origin;
reference = ((Level)host).GetPlaneReference();
closest = true;
}
else
{
location = host.ClosestPointOn(origin, out reference, out closest, orientation?.BasisZ, linkInstance, settings);
if (location == null || reference == null)
return null;
}

XYZ refDir = XYZ.BasisX;
if (orientation?.BasisX != null)
Expand Down

0 comments on commit 0a03dae

Please sign in to comment.