How to use the addColumnAttachement Method

How to use the addColumnAttachement Method

zrodgersTSSSU
Advocate Advocate
473 Views
4 Replies
Message 1 of 5

How to use the addColumnAttachement Method

zrodgersTSSSU
Advocate
Advocate

Im looking for an example of how to use the addColumnAttachment Method. Having trouble understanding how to implement it. Please let me know if you have any examples.

 

https://www.revitapidocs.com/2015/27944249-fe98-f6ef-ba85-6408535b2d0b.htm

0 Likes
Accepted solutions (1)
474 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

I asked the development team for you.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

zrodgersTSSSU
Advocate
Advocate

Any response from the dev. team?

0 Likes
Message 4 of 5

so-chong
Advocate
Advocate
Accepted solution

Hi,

Here i have a very basic and simple macro that demonstrate the use of the addColumnAttachment Method.

 

public void AttachColunm()
{
    UIDocument uidoc = this.ActiveUIDocument; 
    Document doc = this.ActiveUIDocument.Document;

    using (Transaction t = new Transaction(doc, "attach column to beam"))
	{
	t.Start();
	
    Reference myRef = uidoc.Selection.PickObject(ObjectType.Element, "Select column");			
	FamilyInstance column = doc.GetElement(myRef) as FamilyInstance;

    Reference myRef2= uidoc.Selection.PickObject(ObjectType.Element, "Select beam");
	FamilyInstance targetBeam = doc.GetElement(myRef2) as FamilyInstance;  

	ColumnAttachment.AddColumnAttachment(doc, column, targetBeam, 1, ColumnAttachmentCutStyle.None, 
	                                     ColumnAttachmentJustification.Minimum, 0);
	
	t.Commit();
	}

}

 

First select a column and then select a beam.


It's similar to the Revit end user interface 'Attach Top/Base' button from the Modify | Structural Columns Ribbon tab.

so-chong_0-1623275090827.png

 

I hope this will help you for better understanding and how to implement it.

Message 5 of 5

zrodgersTSSSU
Advocate
Advocate

I totally over complicated it!! thank you so much @so-chong & @jeremy_tammik  for your responses!

 

@so-chong That worked like a charm!

0 Likes