Hi,
All the best for 2019! Maybe my brain is still switched off, hence my question to the forum;
I have a Adaptive Component Family which has a series of reference points. I would like to select certain points for further use with Dynamo.
Is there a way of listing the reference points within the adaptive component family instance?
Thank you!
Hi,
you can use AdaptiveComponent.Locations to get the locations of your reference points, but I don’t know if it’s what you are looking for.
Hi @lucamanzoni
Thank you for your response. I have tried AdaptiveComponent.Locations but it only returns the adaptive placement points and not the reference points. I need a list of the reference points within the adaptive family.
Thanks
Ok then try this python script, it uses this method from the RevitAPI
http://www.revitapidocs.com/2018.1/7991d0f9-e792-94b0-1170-0b8ea27e48ed.htm
edit: this should work for both lists and single elements
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
if isinstance(IN[0],list):
element = UnwrapElement(IN[0])
else:
element = [UnwrapElement(IN[0])]
list = []
TransactionManager.Instance.EnsureInTransaction(doc)
for x in element:
points = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(x)
list.append(points)
TransactionManager.Instance.TransactionTaskDone()
OUT = list
2 Likes
Thank you for the script! I have tried it but it returns the values for the adaptive placement points only? Same result as AdaptiveComponent.Locations (refer to screenshot)
I have tried adjusting the script to use GetInstancePointElementRefIds but it returns the same values for the placement points?
There are 3 types of points:
- Placement Points
- Reference Points
- Shape Handle Points
and 3 available methods in the API
- GetInstancePlacementPointElementRefIds -> Placement Points
- GetInstancePointRefIds -> Placement + ShapeHandle Points
- GetInstanceShapeHandlePointElementRefIds -> ShapeHandle Points
Thank you very much for this! I will adjust accordingly and keep you posted!
Yet again thanks!!
Hi @lucamanzoni
Attached is my adaptive component family, will you test on your side please? For me, the only points listed is the placement points, although the family does contain both placement and reference points.
Thanks
Cross Section_v2.rfa (948 KB)
You are right, I made a mistake in my previous post and I will correct it now: the second method gives you Placement + ShapeHandle points.
I haven’t found so far a method in the API to get the reference points from a project environment, but if you are working in the family environment it is possible:
What do you want to do once you get the points? Maybe there is a workaround.
@stefan.oberholzer Use Element.Geometry , filter out the Points and then figure out a way to obtain the desired points (three lowest ones from each sublist, maybe)
2 Likes
Thank you for your effort and assistance!
I want to use the reference points for creating curves for referencing other elements to. For now, I have identified the individual curves’ midpoints and created a point list.
It would be cool if the API can expose reference points in AC families at some point in the future.
@Vikram_Subbaiah
This works for exposing the points!
Thank you @lucamanzoni and @Vikram_Subbaiah for your help, much appreciated!
@Vikram_Subbaiah,
Forgot to mention, I had to use Autodesk.Point to filter the points, and not only Point
Thanks again!