Hi,
is it possibility to set active work plane for some view ?
There are ..ActiveView.ShowActiveWorkPlane() and
HideActiveWorkPlane() but how to set active plane ?
Thank you for advance.
Solved! Go to Solution.
Link copied
Hi,
is it possibility to set active work plane for some view ?
There are ..ActiveView.ShowActiveWorkPlane() and
HideActiveWorkPlane() but how to set active plane ?
Thank you for advance.
Solved! Go to Solution.
Hi
The following code shows how to creata a new SketchPlane and assign it as the active workplane.
UIApplication uiApp = commandData.Application;
UIDocument uiDoc = uiApp.ActiveUIDocument;
// Setting workplane
using (Transaction transaction = newTransaction(uiDoc.Document, "tt"))
{
transaction.Start();
Plane plane = newPlane(uiDoc.ActiveView.ViewDirection, uiDoc.ActiveView.Origin);
SketchPlane sp = uiDoc.Document.Create.NewSketchPlane(plane);
uiDoc.ActiveView.SketchPlane = sp;
uiDoc.ActiveView.ShowActiveWorkPlane();
transaction.Commit();
}
I hope this helps.
cheers
Dear Saikat!
Thank you for advance.
Try to use it.
Hi Ning,
Yes, you can. Saikat's code create a sketch plane from scratch. You can also call SketchPlane.Create(Reference refPlanar) to create a sketch plane using an existing planar plane.
public static SketchPlane Create( Document document, Reference planarFaceReference )
______________________________________________________________
If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
Hi Ning,
Sorry for the misunderstanding.
You can get the SketchPlane from the existing document. SketchPlane instances are store in Revit document. Just follow the element filtering way to get your target sketch plane.
I know this is an older post. Can the solution to this be applied with Dynamo in the Code Block or Python? I not too familiar with python, but I think this route would help me achieve what I am trying to in Dynamo and get the work plane set before placing elements. Not sure what my input and output need to be set at.
The method for the creation of the Plane has changed, in case anyone needs this i'll leave a code snippet:
using(Transaction t = new Transaction(doc, "Creating sketchplane"))
{
t.Start();
Plane plane = Plane.CreateByNormalAndOrigin(doc.ActiveView.ViewDirection, doc.ActiveView.Origin);
SketchPlane sp = SketchPlane.Create(doc, plane);
doc.ActiveView.SketchPlane = sp;
t.Commit();
}