Hi @YuhanZhang,
Isn't the content center always a library?
I've been able to get the Component Definition of the family template like this:
Function GetProfile() As PartComponentDefinition
Dim oContentCenter As ContentCenter
oContentCenter = ThisApplication.ContentCenter
Dim oContentNode As ContentTreeViewNode
oContentNode = oContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes")
Dim oChannelsNode As ContentTreeViewNode = oContentNode.ChildNodes.Item("Channels")
Dim oFamily As ContentFamily
oFamily = GetFamily(oChannelsNode, "UPE-balk")
Dim ProfileDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oFamily.TemplateFileName, False)
Dim ProfileDefinition As PartComponentDefinition
ProfileDefinition = ProfileDoc.ComponentDefinition
Return ProfileDefinition
ProfileDoc.Close(True)
End Function
Function GetFamily(oNode As ContentTreeViewNode, oName As String) As ContentFamily
For Each oFam As ContentFamily In oNode.Families
If oFam.DisplayName = oName Then
Return oFam
Exit Function
End If
Next
Return Nothing
End Function
This ComponentDefinition can then be used to create a ComponentGraphics object. However i would like to be able to get the profile of a specific row in the content family and then be able to use that profile to create a preview of the frame member with a length of my choosing. Im thinking it might be done by getting the lines and curves of the profile sketch and then add lines with my desired length from all start/end points of these ,normal to the sketchplane. Then finally add the profile to the end of these lines aswell.
I feel like it should be doable by adding LineGraphics etc to a GraphicsNode even though it'll most certainly be a bit difficult.
I'm basically trying to copy the preview behavior of frame generator and this is my best guess of how it's done. If you know how to retrieve the sketch geometry of a specific row from content center, or if you have a better idea of how to create this preview alltogether it would be very much appreciated 🙂