本文整理汇总了C#中Floor.get_Parameter方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.get_Parameter方法的具体用法?C# Floor.get_Parameter怎么用?C# Floor.get_Parameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor.get_Parameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Initialization and find out a slab's Level, Type name, and set the Span Direction properties.
/// </summary>
/// <param name="revit">The revit object for the active instance of Autodesk Revit.</param>
/// <returns>A value that signifies if your initialization was successful for true or failed for false.</returns>
private bool Initialize(Autodesk.Revit.UI.UIApplication revit)
{
m_slabComponent = revit.ActiveUIDocument.Selection.Elements;
m_document = revit.ActiveUIDocument.Document;
// There must be exactly one slab selected
if (m_slabComponent.IsEmpty)
{
// nothing selected
MessageBox.Show("Please select a slab.");
return false;
}
else if (1 != m_slabComponent.Size)
{
// too many things selected
MessageBox.Show("Please select only one slab.");
return false;
}
foreach (Element e in m_slabComponent)
{
// If the element isn't a slab, give the message and return failure.
// Else find out its Level, Type name, and set the Span Direction properties.
if ("Autodesk.Revit.DB.Floor" != e.GetType().ToString())
{
MessageBox.Show("A slab should be selected.");
return false;
}
// Change the element type to floor type
m_slabFloor = e as Floor;
// Get the layer information from the type object by using the CompoundStructure property
// The Layers property is then used to retrieve all the layers
m_slabLayerCollection = m_slabFloor.FloorType.GetCompoundStructure().GetLayers();
m_numberOfLayers = m_slabLayerCollection.Count;
// Get the Level property by the floor's Level property
m_level = m_slabFloor.Level.Name;
// Get the Type name property by the floor's FloorType property
m_typeName = m_slabFloor.FloorType.Name;
// The span direction can be found using generic parameter access
// using the built in parameter FLOOR_PARAM_SPAN_DIRECTION
Parameter spanDirectionAttribute;
spanDirectionAttribute = m_slabFloor.get_Parameter(BuiltInParameter.FLOOR_PARAM_SPAN_DIRECTION);
if (null != spanDirectionAttribute)
{
// Set the Span Direction property
this.SetSpanDirection(spanDirectionAttribute.AsDouble());
}
}
return true;
}
示例2: CloneElement
/// <summary>
///
/// </summary>
/// <param name="app"></param>
/// <param name="floor"></param>
/// <returns></returns>
private static Revit.Element CloneElement( Autodesk.Revit.UI.UIApplication app, Floor floor )
{
//get geometry to figure out location of floor
Options options = app.Application.Create.NewGeometryOptions();
options.DetailLevel = ViewDetailLevel.Coarse;
GeometryElement geomElem = floor.get_Geometry( options );
Solid solid = null;
foreach( GeometryObject geoObject in geomElem )
{
if( geoObject is Solid )
{
solid = geoObject as Solid;
break;
}
}
Level level = floor.Document.GetElement( floor.LevelId ) as Level;
double absoluteElev = level.Elevation + floor.get_Parameter( BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM ).AsDouble();
CurveArray curveArray = Utils.Geometry.GetProfile( solid, absoluteElev, app.Application );
Floor floorClone = app.ActiveUIDocument.Document.Create.NewFloor( curveArray, floor.FloorType, level, false );
Utils.ParamUtil.SetParameters( floorClone.Parameters, floor.Parameters );
return floorClone;
}
示例3: SetParameters
private void SetParameters(Floor floor, IEnumerable<RevitParameter> parameters, Document doc)
{
foreach (RevitParameter rp in parameters)
{
try
{
Parameter p = floor.get_Parameter(rp.ParameterName);
switch (rp.StorageType)
{
case "Double":
if (p.Definition.ParameterType == ParameterType.Area)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), areaDUT));
else if (p.Definition.ParameterType == ParameterType.Volume)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), volumeDUT));
else if (p.Definition.ParameterType == ParameterType.Length)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), lengthDUT));
else
p.Set(Convert.ToDouble(rp.Value));
break;
case "Integer":
p.Set(Convert.ToInt32(rp.Value));
break;
case "String":
p.Set(rp.Value);
break;
case "ElementId":
if (p.Definition.ParameterType == ParameterType.Material)
p.Set(GetMaterial(rp.Value, doc));
else
p.Set(new ElementId(Convert.ToInt32(rp.Value)));
break;
default:
p.Set(rp.Value);
break;
}
}
catch
{
try
{
Parameter p = floor.FloorType.get_Parameter(rp.ParameterName);
switch (rp.StorageType)
{
case "Double":
if (p.Definition.ParameterType == ParameterType.Area)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), areaDUT));
else if (p.Definition.ParameterType == ParameterType.Volume)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), volumeDUT));
else if (p.Definition.ParameterType == ParameterType.Length)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), lengthDUT));
else
p.Set(Convert.ToDouble(rp.Value));
break;
case "Integer":
p.Set(Convert.ToInt32(rp.Value));
break;
case "String":
p.Set(rp.Value);
break;
case "ElementId":
if (p.Definition.ParameterType == ParameterType.Material)
p.Set(GetMaterial(rp.Value, doc));
else
p.Set(new ElementId(Convert.ToInt32(rp.Value)));
break;
default:
p.Set(rp.Value);
break;
}
}
catch (Exception ex)
{
TaskDialog.Show("Error", ex.Message);
}
}
}
}
示例4: Recognization
public static bool Recognization(Floor slab)
{
_slab = slab;
XYZ minAdj = new XYZ(-ErrorCTRL_SlabBB, -ErrorCTRL_SlabBB, -ErrorCTRL_SlabBB);
XYZ maxAdj = new XYZ(ErrorCTRL_SlabBB, ErrorCTRL_SlabBB, -ErrorCTRL_SlabBB);
BoundingBoxXYZ bbXYZ = slab.get_BoundingBox(_doc.ActiveView);
BoundingBoxIntersectsFilter bbif =
new BoundingBoxIntersectsFilter(new Outline(bbXYZ.Min + minAdj, bbXYZ.Max + maxAdj));
if ((new FilteredElementCollector(_doc)).WherePasses(bbif).
WherePasses(new ElementStructuralTypeFilter(StructuralType.Beam)).Count() != 0)
return false;
_columns = (new FilteredElementCollector(_doc)).WherePasses(bbif).OfCategory(BuiltInCategory.OST_Columns).ToList();
Level level = (Level)_doc.GetElement(slab.get_Parameter(BuiltInParameter.SCHEDULE_LEVEL_PARAM).AsElementId());
double offset = slab.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM).AsDouble();
bool isFound;
_floor = _myLevel.GetFloor(out isFound, level, offset);
if (!isFound)
{
_abandonWriter.WriteAbandonment(slab, AbandonmentTable.LevelNotFound);
return false;
}
if (_doc.GetElement(slab.FloorType.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()).Name
== _addiInfo.materialTypes[(byte)PGMaterialType.PrestressConcrete])
_isPrestress = true;
else _isPrestress = false;
return true;
}
示例5: SetParameters
private void SetParameters(Floor floor, IEnumerable<RevitParameter> parameters, Document doc)
{
foreach (RevitParameter rp in parameters)
{
try
{
Parameter p = floor.get_Parameter(rp.ParameterName);
switch (rp.StorageType)
{
case "Double":
if (p.Definition.ParameterType == ParameterType.Area)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), areaDUT));
else if (p.Definition.ParameterType == ParameterType.Volume)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), volumeDUT));
else if (p.Definition.ParameterType == ParameterType.Length)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), lengthDUT));
else
p.Set(Convert.ToDouble(rp.Value));
break;
case "Integer":
p.Set(Convert.ToInt32(rp.Value));
break;
case "String":
p.Set(rp.Value);
break;
case "ElementId":
try
{
int idInt = Convert.ToInt32(rp.Value);
ElementId elemId = new ElementId(idInt);
Element elem = doc.GetElement(elemId);
if (elem != null)
{
//TaskDialog.Show("Test:", "Param: " + p.Definition.Name + "\nID: " + elemId.IntegerValue.ToString());
p.Set(elemId);
}
}
catch
{
try
{
p.Set(p.Definition.ParameterType == ParameterType.Material
? GetMaterial(rp.Value, doc)
: new ElementId(Convert.ToInt32(rp.Value)));
}
catch (Exception ex)
{
//TaskDialog.Show(p.Definition.Name, ex.Message);
}
}
break;
default:
p.Set(rp.Value);
break;
}
}
catch
{
try
{
Parameter p = floor.FloorType.get_Parameter(rp.ParameterName);
switch (rp.StorageType)
{
case "Double":
if (p.Definition.ParameterType == ParameterType.Area)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), areaDUT));
else if (p.Definition.ParameterType == ParameterType.Volume)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), volumeDUT));
else if (p.Definition.ParameterType == ParameterType.Length)
p.Set(UnitUtils.ConvertToInternalUnits(Convert.ToDouble(rp.Value), lengthDUT));
else
p.Set(Convert.ToDouble(rp.Value));
break;
case "Integer":
p.Set(Convert.ToInt32(rp.Value));
break;
case "String":
p.Set(rp.Value);
break;
case "ElementId":
try
{
int idInt = Convert.ToInt32(rp.Value);
ElementId elemId = new ElementId(idInt);
Element elem = doc.GetElement(elemId);
if (elem != null)
{
//TaskDialog.Show("Test:", "Param: " + p.Definition.Name + "\nID: " + elemId.IntegerValue.ToString());
p.Set(elemId);
}
}
catch
{
try
{
p.Set(p.Definition.ParameterType == ParameterType.Material
? GetMaterial(rp.Value, doc)
: new ElementId(Convert.ToInt32(rp.Value)));
}
catch (Exception ex)
//.........这里部分代码省略.........