« User Visible Enumeration Value Labels | Main | Element Level Events »

April 13, 2010

Comments

dear Jeremy Tammik

where from could I get the ids of path reinforcement parameters such as : "Primary Bar - Start Hook Type " :None
and Face :("Exterior" and "Interior")

for example : i want to change "face" of Path Reinforcement Object by code to make it "Exterior" insted of "Interior" where could i find Exterior parameter ID?
thanks you

Dear Basil,

As so often when exploring how to automate things in Revit, you will probably need to explore some of this for yourself interactively. Create a sample model and toggle the features you are interested in on and off manually through the user interface. At the same time, check what parameters are affected by analysing the model using RevitLookup. That should provide all the answers you need.

I did notice that the Revit Structure 2011 API introduced a new NewRebarHookType method:

http://thebuildingcoder.typepad.com/blog/2010/05/the-revit-structure-2011-api.html

I also once had a conversation on setting the rebar end hook parameters using
BuiltInParameter.REBAR_ELEM_HOOK_START_TYPE and BuiltInParameter.REBAR_ELEM_HOOK_END_TYPE. If you set them to new ElementId( -1 ), you can simulate setting them to End Hook “None”. Here is the code we looked at back then:

transaction.Start( "Turn Off End Hook 1" );
Parameter hookStartParam = rebar.get_Parameter(
BuiltInParameter.REBAR_ELEM_HOOK_START_TYPE );

ElementId oldId = hookStartParam.AsElementId();
hookStartParam.Set( new ElementId( -1 ) );
transaction.Commit();

transaction.Start( "Turn Off End Hook 2" );
Parameter hookEndParam = rebar.get_Parameter(
BuiltInParameter.REBAR_ELEM_HOOK_END_TYPE );

ElementId oldId = hookEndParam.AsElementId();

hookEndParam.Set( new ElementId( -1 ) );
transaction.Commit();

I hope this helps.

Cheers, Jeremy.

Hi Jeremy
When I create a new moment connection type.(for example new symbol for RBS Moment Frame) a new StructuralConnectionType Id is generated randomly by Revit.(something like 3975667)
Are there anyway to make the Id state the same?
Thanks

Dear Locost7,

The StructuralConnectionType element id is probably not generated randomly.

Instead, I imagine that Revit is generating a new StructuralConnectionType element for you, and that is its element id.

You can check this by using the element lister:

http://thebuildingcoder.typepad.com/blog/2014/09/debugging-and-maintaining-the-image-relationship.html#2

You can also simply snoop the current database in RevitLookup and manually check whether a new StructuralConnectionType element has been added.

If the newly generated StructuralConnectionType element is identical to another StructuralConnectionType element that you already have in your project and would like to reuse, you can probably do so through the following steps:

1. Make a note of the newly generated element id X.

2. Determine the element id Y of the StructuralConnectionType that you would like to reuse for your new moment connection type Z.

3. Assign Y to Z, e.g. using the Element.ChangeTypeId method.

4. Delete X, e.g. using the Document.Delete method.

I hope this helps.

Please let us know how you end up solving this.

Thank you!

Cheers, Jeremy.

Thanks for your reply Jeremy
I think I was thinking in a wrong direction when I was asking for help.
Actually I’m trying to write a code to assign Start/End Connection. To do this I need to
set new ElementID to the build in parameter. In this case a different ElementID mapping can be problematic. But I just found out there is no need to make the ElementID state the same. My solution is to retrieve the ElementID from the name of the Connection Type.

//Get Parameter:
BuiltInParameter.STRUCT_CONNECTION_BEAM_START

//filter by the StructuralConnectionType class
foreach (Element ConnType in new FilteredElementCollector(doc)
.OfClass(typeof(StructuralConnectionType))
.Cast()
.Where( m => m.Name.Equals("Moment Frame RBS")))

// Get ElementID and Convert to integer:
string NewId = ConnType.Id.ToString();
int idInt = Convert.ToInt32(NewId);
p.Set(new ElementId(idInt));

The key is to make sure the name is always the same for every project.
so now what I planing to do is to write a code to create the new Structural Connection Types instead of make them in the Structural Setting Panel manually. But somehow I got stuck on the StructuralConnectionType.Create Method. I’m not able to find any code snippets yet.
any suggestion for my solution?

BTW I just replaced my temporary username Locost7 to Sarkate which match the one I use in the official Autodesk API forum.

Thanks

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource