Changing or Moving an Existing FamilyInstance object to a different Work Plane or a newly created SketchPlane object

kevin.anggrek
Enthusiast
Enthusiast

Changing or Moving an Existing FamilyInstance object to a different Work Plane or a newly created SketchPlane object

kevin.anggrek
Enthusiast
Enthusiast

Hi all,

 

Does anyone know how to change the Work Plane where a FamilyInstance object is placed on or how to move the FamilyInstance object to a different Work Plane programmatically?

 

I noticed that when a FamilyInstance object is selected through the UI, two options (Edit Work Plane and Pick New) would appear in the Modify | <Element> tab that will allow us to modify the Work Plane of the currently selected instance. How to do this process through the API?

Editing the Work Plane through the UIEditing the Work Plane through the UI

I tried to create a new Plane object and then a new SketchPlane object based on that Plane object. Afterwards, I tried to set the SketchPlane into the BuiltInParameter.SKETCH_PLANE_PARAM of the FamilyInstance. However, that specific enumeration of the BuiltInParameter turned out to be a read-only parameter. Previous articles related to the subject has only discussed the creation of new SketchPlane object and setting them as the SketchPlane of the Active View.

 

I believe that since this process can be done through the UI (By using the Edit Work Plane and Pick New functions) then the Revit API should have a way to replicate it as well.

 

Thanks in advance!

0 Likes
Reply
579 Views
2 Replies
Replies (2)

jeremy_tammik
Autodesk
Autodesk

Here is an old approach that enables you to Detach Beam from Plane. Will that help you in any way?

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

kevin.anggrek
Enthusiast
Enthusiast

Hi sir @jeremy_tammik Thank you for the suggested approach.

 

I find that by using the approach described in your blog, I was able to detach the beam from the work plane. However, I still can't find a way to attach or assign the now detached beam to a new work plane.

 

By detaching the beam from the work plane as shown in the approach suggested in your blog, the Work Plane parameter of the beam (BuiltInParameter.SKETCH_PLANE_PARAM) is now gone and inaccessible (the parameter also becomes inaccessible through the API since it was removed from the UI), leaving only the Reference Level parameter. However, what I wanted to do was moving or assigning the beam to a new work plane that I have created, not moving it to a different level using the Reference Level parameter.

Before detachment, the beam is attached to a read-only Work Plane parameterBefore detachment, the beam is attached to a read-only Work Plane parameterAfter detachment, the beam is no longer attached to any Work Plane, the Work Plane parameter is now removedAfter detachment, the beam is no longer attached to any Work Plane, the Work Plane parameter is now removed

By following this ADN DevBlog's article I was able to create my own SketchPlane object and set it as the work plane of the active view. My question remains, how to move the beam to this plane?

 

It should also be noted that I can't change the Host of the FamilyInstance beam objects to be the newly created SketchPlane object since the Host property is read-only. Another thing to note is that the family of the beams are not Work Plane-based since I don't see that parameter when editing the family.

 

Any ideas on how I can solve this?

Thank you very much