- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Using Revit API 2019 and Advance Steel API 2019
I have simple task to connect a beam and column with the Structural Connection (Clip angle) and update its Modify Parameters.
I am able to create a connection between beam and column with Structural Connection (Clip angle) but when i go to modify the Parameters of newly created Structural Connection it gives null
below code to create a connection and modify it
StructuralConnectionHandler structuralConnectionHandler = null; using (Transaction transaction = new Transaction(uidoc.Document, "Create detailed structural connection")) { List<ElementId> elemIds = new List<ElementId>(); // retrive element from document foreach (int id in selectedIDs) elemIds.Add(doc.GetElement(new ElementId(id)).Id); // The type is from the SteelConnectionsData.xml file. StructuralConnectionHandlerType connectionType = StructuralConnectionHandlerType.Create(uidoc.Document, "usclipangle", new Guid("A42C5CE5-91C5-47E4-B445-D053E5BD66DB"), "usclipangle"); if (elemIds.Count() > 0 && connectionType != null) { //using (SubTransaction subTransaction = new SubTransaction(uidoc.Document)) //{ // subTransaction.Start(); structuralConnectionHandler = StructuralConnectionHandler.Create(uidoc.Document, elemIds, connectionType.Id); // subTransaction.Commit(); //} uidoc.Document.Regenerate(); } else { message = "There is no element selected!"; ret = Result.Failed; } TransactionStatus ts = transaction.Commit(); } // uidoc.Document.Save(); // tried to save document automatically but gives wired exception eg. Autodesk.Internal Exception bool modifyParameters = true// would be setting its value while debug. if (modifyParameters) { // Start detailed steel modeling transaction using (FabricationTransaction trans = new FabricationTransaction(doc, true, "Update connection parameters")) { AdvSteel.FilerObject filerObject = Functions.GetFilerObject(uidoc.Document, new Reference(structuralConnectionHandler)); //filerObject object is null always // this piece of code works independently if (null == filerObject || !(filerObject is UserAutoConstructionObject)) return Result.Failed; UserAutoConstructionObject asConnection = (UserAutoConstructionObject)filerObject; //read connection parameters IFiler connectionFiler = asConnection.Save(); if (connectionFiler != null) { //I choose to modify thickess of the base plate connectionFiler.WriteItem(Convert.ToDouble(50.0), "BaseThickness"); //units must be milimmeters; asConnection.Load(connectionFiler); //update connection parameters asConnection.Update(); // //if the connection parameters are modified, than we have to set this flag to true, //meaning that this connection has different parameters than it's connection type. // not avaliabe in revit 2019 //rvtConnection.OverrideTypeParams = true; // not avaliabe in revit 2019 /// trans.Commit(); } } }
Tried So far:
Tried to commit in sub-transaction.
Tried to save the document after commit.
went through below link
Revit Dynamo: revit-api-access-to-structural-connection-parameters
Autodesk Revit API: accessing-detailed-parameters-in-a-structural-steel-connection
Any help or hint would be appreciated!
Solved! Go to Solution.