
Posts by demetris:
Changing Element Properties in Revit Structure
November 22nd, 2011When you define Beams in Revit Structure the software automatically draws a driving line on top of the Beam. That line will meet a same line from a Column and their meeting point will actually become a node. So the “z-Direction Justification” is a property of Beams that describes the vertical position of the beam related with the imaginary line that connects the start and end point of the Beam. This parameter can get 3 different values TOP / CENTER / BOTTOM and we imagine the difference.
So using the SAP_2_ RS tool, we needed to set the z-Direction Justification to CENTER in order to be precise and the code is the following.(the default value is on TOP)
‘drawing beam
myBeam = myModel.Create.NewFamilyInstance(myBeamLine, beam_sym, my_level, Autodesk.Revit.DB.Structure.StructuralType.Beam)
‘giving the right z Direction Justification
Dim V_justification As Autodesk.Revit.DB.BuiltInParameter = Autodesk.Revit.DB.BuiltInParameter.BEAM_V_JUSTIFICATION
Dim myParameter As Autodesk.Revit.DB.Parameter = myBeam.Parameter(V_justification)
myParameter.[Set](1) ’ here: 0 is Top / 1 is Center / 2 is Bottom
These lines need to be used after “drawing” the beam and this is the way to approach and change other parameters of elements if needed.. (got a lot of intelligense there)
enjoy
Open Dialog Box
November 9th, 2011The tool Sap_2_Rs asks the User (to the Revit Structure environment) to open the Sap2000 file that he wishes to import the geometry.
This happens by calling the OpenFileDialog box:
‘ Configure open file dialog box
Dim dlg As New Microsoft.Win32.OpenFileDialog()
dlg.FileName = “Select Sap model to import” ‘ Default file name
dlg.DefaultExt = “.sdb” ‘ Default file extension
dlg.Filter = “SAP MODEL Files (.sdb)|*.sdb” ‘ Filter files by extension
‘ Show open file dialog box
Dim result? As Boolean = dlg.ShowDialog()
Dim filename As String = dlg.FileName
If result = True Then
‘start the Sap2000 application
SapObject.ApplicationStart()
ret = SapModel.InitializeNewModel ‘initialize model
ret = SapModel.File.OpenFile(filename) ‘open specific file
End If
———————————————————————————————
Don’t forget to add the “PresentationFramework” reference (type.NET)
Revit API and SDK files
November 1st, 2011The Revit SDK file has really useful files in order to get started, scripting with Revit API… This is a video found from autodesk that quickly presents the SDK file http://download.autodesk.com/us/firstplugin/revit/exploring_the_revit_sdk_1044x828.html
You can download the Revit SDK file from Autodesk website
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975
as long as you have an activated Autodesk account…
So between these files the Revit API is included and also a pdf called “Revit 20xx API Developer Guide” which has many useful details for a new programmer in Revit