You are on page 1of 6

11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk

Walkthrough: Creating Model Connectors and Relations

Once beams and plates are in place, connect them with bolts, anchors or welds.

This walkthrough will familiarize you with the basic concepts of connecting model elements in an Advance
Steel model with bolts, anchors and welds using the API. Refer back to the Hello World walkthrough to
create an empty Advance Steel addon project, up to the point of creating the command class. This tutorial
assumes you have a new Advance Steel addon project with one class file that implements the
IExtensionApplication interface.

Create a new class called CreateConnectors and add the following code:

Code Region: CreateConnectors command class

using Autodesk.AdvanceSteel.CADAccess;

using Autodesk.AdvanceSteel.DocumentManagement;

using Autodesk.AdvanceSteel.Runtime;

using Autodesk.AdvanceSteel.Geometry;

using Autodesk.AdvanceSteel.Modelling;

using Autodesk.AdvanceSteel.Profiles;

using System.Collections.Generic;

namespace HelloWorld

public class CreateConnectors

[CommandMethodAttribute("TEST_GROUP", "CreateConnectors", "CreateConnectors",

CommandFlags.Modal |
CommandFlags.UsePickSet | CommandFlags.Redraw)]

public void Create()

using (DocumentAccess da = new DocumentAccess(null, false))

da.Commit();

Before we can add connections, we need something to connect. Let's start with two short columns. Add a
method called CreateStackedColumns() to the CreateConnectors class to add 2 stacked columns like this:

https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 1/6
11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk

Code Region: Create stacked columns

private void CreateStackedColumns(out StraightBeam bottomColumn, out StraightBeam


topColumn)

//create 2 stacked columns

Point3d beamEnd = new Point3d(0, 0, 350);

Point3d beamStart = new Point3d(0, 0, 0);

bottomColumn = new StraightBeam("HEA DIN18800-1#@§@#HEA300", beamStart, beamEnd,


Vector3d.kXAxis);

bottomColumn.WriteToDb();

beamEnd = new Point3d(0, 0, 700);

beamStart = new Point3d(0, 0, 350);

topColumn = new StraightBeam("HEA DIN18800-1#@§@#HEA200", beamStart, beamEnd,


Vector3d.kXAxis);

topColumn.WriteToDb();

Connecting objects with bolts


Bolts are added to an Advance Steel model in a pattern. Bolt patterns create connections between
individual Advance Steel objects, for example beam/plate or plate/plate. The Advance Steel API classes
used for creating bolt patterns correspond to the types of bolt patterns available from the Advance Steel
UI and include:

FinitRectScrewBoltPattern
InfinitRectScrewBoltPattern
InfinitMidScrewBoltPattern
CircleScrewBoltPattern

For this tutorial, we will create a bolt pattern in a rectangular area, defined by diagonally opposite corner
points, with 8 bolts. Add a new method to the CreateConnectors class called ConnectColumnsWithBolts as
shown below.

Code Region: Connect objects with bolts

private void ConnectColumnsWithBolts(StraightBeam bottomColumn, StraightBeam


topColumn)

//create a plate between the columns

Point3d plateOrig = topColumn.GetPointAtStart();

Plane platePlane = new Plane(plateOrig, Vector3d.kYAxis);

Plate myPlate = new Plate(platePlane, plateOrig, 100, 200);

https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 2/6
11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk

myPlate.WriteToDb();

// create a standard rectangular pattern set of bolts

FinitRectScrewBoltPattern boltPattern = new FinitRectScrewBoltPattern(new


Point3d(plateOrig.x - 25, plateOrig.y, plateOrig.z - 75),

new
Point3d(plateOrig.x + 25, plateOrig.y, plateOrig.z + 75),

new
Vector3d(1, 0, 0), new Vector3d(0, 0, 1));

boltPattern.WriteToDb();

boltPattern.Nx = 2;

boltPattern.Ny = 4; // create a 2x4 bolt pattern

// connect the objects

FilerObject[] objectsToConnect = { bottomColumn , topColumn, myPlate };

boltPattern.Connect(objectsToConnect, AtomicElement.eAssemblyLocation.kOnSite);

The code above first creates a plate between the given columns. Then the rectangular bolt pattern is
defined based on the plate's location. The number of bolts defined for the local x and y axis can be set after
the pattern is created. In this case, it will create a 2x4 pattern of bolts.

The last step is to connect the objects together with the bolt pattern. A HashSet< FilerObject> collection is
filled with the objects to be connected and then used by the Connect() method. In this case, the plate and
two columns are added to the collection.

Note that the Connect() method takes a parameter indicating the assembly location (on site in the code
above). The AtomicElement class used for this parameter is in the
Autodesk.AdvanceSteel.ConstructionTypes. Add the following using statement to the top of the class file:

Code Region: Construction types namespace

using Autodesk.AdvanceSteel.ConstructionTypes;

Connecting objects with anchors


Anchors are created very similarly to bolts, using the AnchorPattern class. Add a new method to the
CreateConnectors class called CreateBaseplateWithAnchors as shown below.

Code Region: Using anchors

private void CreateBaseplateWithAnchors(StraightBeam column, out Plate plate)

https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 3/6
11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk
{

//create a baseplate

Point3d plateOrig = column.GetPointAtStart();

Plane platePlane = new Plane(plateOrig, Vector3d.kZAxis);

plate = new Plate(platePlane, plateOrig, 500, 500);

plate.WriteToDb();

// create a standard rectangular pattern set of bolts

AnchorPattern anchorPattern = new AnchorPattern(new Point3d(plateOrig.x - 150,


plateOrig.y - 150, plateOrig.z),

new Point3d(plateOrig.x + 150,


plateOrig.y + 150, plateOrig.z),

new Vector3d(1, 0, 0), new


Vector3d(0, 1, 0));

anchorPattern.WriteToDb();

// set a valid combination of properties, like for the bolt

anchorPattern.Standard = "ANCHOR CANE";//"French cane anchor";

anchorPattern.Grade = "4.6";

anchorPattern.BoltAssembly = "2M";//"2N";

anchorPattern.ScrewDiameter = 16;

// create a 1x2 bolt pattern

anchorPattern.Nx = 1;

anchorPattern.Ny = 2;

// connect the objects

FilerObject[] objectsToConnect = { plate };

anchorPattern.Connect(objectsToConnect, AtomicElement.eAssemblyLocation.kOnSite);

As seen in the code above, the AnchorPattern is defined the same as the FinitRectScrewBoltPattern was -
by diagonally opposite corner points. Rather than using the default anchor type, this code will change the
bolts used for the anchor to "French cane anchor". The AnchorPattern properties need to be set to a valid
combination of properties. Valid sets of properties can be determined from the Anchors tool in the
Advance Steel Management Tools (a separate application installed with Advance Steel).

Connecting objects with welds


Welds are created as weld points (using the WeldLevel class) or weld lines (using the WeldStraight class).
Add a new method to the CreateConnectors class called WeldColumnToPlate as shown below.

Code Region: Connect objects with welds

private void WeldColumnToPlate(StraightBeam column, Plate plate)

// create a weld

WeldPoint weld = new WeldPoint(new Point3d(145, 0, 0), new Vector3d(1, 0, 0), new
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 4/6
11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk
Vector3d(0, 1, 0));

weld.WriteToDb();

// connect the objects

FilerObject[] objectsToConnect = { column, plate };

weld.Connect(objectsToConnect, AtomicElement.eAssemblyLocation.kInShop);

// create second weld

weld = new WeldPoint(new Point3d(-145, 0, 0), new Vector3d(1, 0, 0), new


Vector3d(0, 1, 0));

weld.WriteToDb();

weld.Connect(objectsToConnect, AtomicElement.eAssemblyLocation.kInShop);

The code above will add two weld points connecting the bottom of the column to the provided plate.

Creating the connectors


Now we can use all the methods created above to create some elements and connect them with various
connection types. Update the first Create() method to include the code as shown below:

Code Region: Connect objects with welds

public void Create()

using (DocumentAccess da = new DocumentAccess(null, false))

StraightBeam bottomColumn, topColumn;

CreateStackedColumns(out bottomColumn, out topColumn);

if (null != bottomColumn && null != topColumn)

ConnectColumnsWithBolts(bottomColumn, topColumn);

Plate basePlate;

CreateBaseplateWithAnchors(bottomColumn, out
basePlate);

WeldColumnToPlate(bottomColumn, basePlate);

da.Commit();

Prior to running this command in Advance Steel, you will need to add the necessary Informational
Attribute directives in the AssemblyInfo.cs file as shown in the Hello World Walkthrough.

https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 5/6
11/10/21, 4:30 PM Help | Walkthrough: Creating Model Connectors and Relations | Autodesk

After running the CreateConnectors command in Advance Steel and zooming in, you should see something
like this:

Parent topic: Walkthroughs

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ
for more information.
© 2021 Autodesk Inc. All rights reserved

https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-0BC13443-7B8B-4393-A1D8-2F79476BB165 6/6

You might also like