本文整理汇总了C#中Wall.get_Parameter方法的典型用法代码示例。如果您正苦于以下问题:C# Wall.get_Parameter方法的具体用法?C# Wall.get_Parameter怎么用?C# Wall.get_Parameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wall
的用法示例。
在下文中一共展示了Wall.get_Parameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWallMidOffsetFromLocation
Double GetWallMidOffsetFromLocation(Wall wall)
{
// First get the "Base Offset" property.
Double baseOffset = wall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
// Second get the "Unconnected Height" property.
Double height = wall.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM).AsDouble();
// Get the middle of of wall elevation from the wall location.
// The elevation of wall location equals the elevation of "Base Constraint" level
Double midOffset = baseOffset + height / 2;
return midOffset;
}
示例2: AddWindow
/// <summary>
/// Add a window to the center of the wall given.
/// cf. Developer Guide p137. NewFamilyInstance() for Doors and Window.
/// Basically the same idea as a door except that we need to set sill hight.
/// </summary>
public void AddWindow(Wall hostWall)
{
// Hard coding the window type we will use.
// E.g., "M_Fixed: 0915 x 1830mm
const string windowFamilyName = Util.Constant.WindowFamilyName;
const string windowTypeName = Util.Constant.WindowTypeName;
const string windowFamilyAndTypeName = windowFamilyName + ": " + windowTypeName;
double sillHeight = Constant.MmToFeet(915);
// Get the door type to use.
FamilySymbol windowType = (FamilySymbol)ElementFiltering.FindFamilyType(_doc, typeof(FamilySymbol), windowFamilyName, windowTypeName, BuiltInCategory.OST_Windows);
if (windowType == null)
{
TaskDialog.Show(
"Add window",
"Cannot find (" +
windowFamilyAndTypeName +
"). Maybe you use a different template? Try with DefaultMetric.rte.");
}
if (!windowType.IsActive)
windowType.Activate();
// Get the start and end points of the wall.
LocationCurve locCurve = (LocationCurve)hostWall.Location;
XYZ pt1 = locCurve.Curve.GetEndPoint(0);
XYZ pt2 = locCurve.Curve.GetEndPoint(1);
// Calculate the mid point.
XYZ pt = (pt1 + pt2) / 2.0;
// we want to set the reference as a bottom of the wall or level1.
ElementId idLevel1 = hostWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsElementId();
//Level level1 = (Level)_doc.get_Element(idLevel1); // 2012
Level level1 = (Level)_doc.GetElement(idLevel1); // since 2013
// Finally create a window.
FamilyInstance aWindow = _doc.Create.NewFamilyInstance(pt, windowType, hostWall, level1, StructuralType.NonStructural);
aWindow.get_Parameter(BuiltInParameter.INSTANCE_SILL_HEIGHT_PARAM).Set(sillHeight);
}
示例3: Recognization
public static bool Recognization(Wall wall)
{
_wall = wall;
_thickness = wall.Width;
_length = wall.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble();
_level_bottom =
_doc.GetElement(wall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsElementId()) as Level;
_level_top =
_doc.GetElement(wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).AsElementId()) as Level;
_offset_bottom = wall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
_offset_top = wall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).AsDouble();
_noConsHeight = wall.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM).AsDouble();
_direction = GetWallDirection(wall);
if (_direction == Direction.Undefined)
{
_abandonWriter.WriteAbandonment(wall, AbandonmentTable.SkewWall);
return false;
}
bool isFound;
_floor_bottom =
_myLevel.GetFloor(out isFound, _level_bottom, _offset_bottom);
_floor_top =
_myLevel.GetWallTopFloor(out isFound, _level_bottom, _offset_bottom, _noConsHeight);
if (!isFound) --_floor_top;
if (!(MyLevel.isLegalFloorIndex(_floor_bottom) && MyLevel.isLegalFloorIndex(_floor_top)))
{
_abandonWriter.WriteAbandonment(_wall as Element, AbandonmentTable.LevelNotFound);
return false;
}
if (_floor_top <= _floor_bottom)
{
_abandonWriter.WriteAbandonment(wall as Element, AbandonmentTable.Wall_WallTooShort);
return false;
}
return true;
}
示例4: AddDoor
/// <summary>
// Add a door to the center of the given wall.
// cf. Developer Guide p137. NewFamilyInstance() for Doors and Window.
/// </summary>
public void AddDoor(Wall hostWall)
{
// Hard coding the door type we will use.
// E.g., "M_Single-Flush: 0915 x 2134mm
const string doorFamilyName = Util.Constant.DoorFamilyName;
const string doorTypeName = Util.Constant.DoorTypeName;
const string doorFamilyAndTypeName = doorFamilyName + ": " + doorTypeName;
// Get the door type to use.
FamilySymbol doorType = (FamilySymbol)ElementFiltering.FindFamilyType(_doc, typeof(FamilySymbol), doorFamilyName, doorTypeName, BuiltInCategory.OST_Doors);
if (doorType == null)
{
TaskDialog.Show(
"Add door",
"Cannot find (" +
doorFamilyAndTypeName +
"). Maybe you use a different template? Try with DefaultMetric.rte.");
}
if (!doorType.IsActive)
doorType.Activate();
// Get the start and end points of the wall.
LocationCurve locCurve = (LocationCurve)hostWall.Location;
XYZ pt1 = locCurve.Curve.GetEndPoint(0);
XYZ pt2 = locCurve.Curve.GetEndPoint(1);
// Calculate the mid point.
XYZ pt = (pt1 + pt2) / 2.0;
// we want to set the reference as a bottom of the wall or level1.
ElementId idLevel1 =
hostWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsElementId();
//Level level1 = (Level)_doc.get_Element(idLevel1); // 2012
Level level1 = (Level)_doc.GetElement(idLevel1); // since 2013
// Finally, create a door.
FamilyInstance aDoor =
_doc.Create.NewFamilyInstance(
pt, doorType, hostWall, level1, StructuralType.NonStructural);
}
示例5: HostedFamilyInstanceOpenings
private static void HostedFamilyInstanceOpenings(Wall wall,
double minOpeningValue)
{
double wallOpeningArea = 0.0;
double wallTotalOpeningArea = 0.0;
// Filter all Family Instances where the HOST_ID_PARAM
// equals the wall ID
//
// More information at
// http://thebuildingcoder.typepad.com/
// blog/2010/06/parameter-filter.html#4
BuiltInParameter testParam =
BuiltInParameter.HOST_ID_PARAM;
ParameterValueProvider pvp =
new ParameterValueProvider(
new ElementId((int)testParam));
FilterNumericRuleEvaluator fnrv = new FilterNumericEquals();
ElementId ruleValId = wall.Id;
FilterRule paramFr = new FilterElementIdRule
(pvp, fnrv, ruleValId);
ElementParameterFilter epf =
new ElementParameterFilter(paramFr);
FilteredElementCollector collector =
new FilteredElementCollector(wall.Document);
collector.OfClass(typeof(FamilyInstance)).WherePasses(epf);
IList<Element> hostedFamilyInstances = collector.ToElements();
// Now iterate through the collected family instances
Document doc = wall.Document;
double previousArea = wall.get_Parameter(
BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
foreach (FamilyInstance instance in hostedFamilyInstances)
{
// Delete the hosted family instace and regenerate
doc.Delete(instance);
doc.Regenerate();
// Get the new area to compare
double newArea = wall.get_Parameter(
BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
// So the instance opening equals:
double instanceAreaOnTheWall =
Math.Abs(newArea - previousArea);
// The element area (on wall) is smaller than
// the minOpeningValue?
if (instanceAreaOnTheWall <= minOpeningValue)
wallOpeningArea += instanceAreaOnTheWall;
else
wallTotalOpeningArea += instanceAreaOnTheWall;
if (System.Diagnostics.Debugger.IsAttached)
TaskDialog.Show(
"Wall opening (by inst) found (in sq feet)",
string.Format("Area: {0}", instanceAreaOnTheWall));
previousArea = newArea;
}
AddWallArea(wall.Id, wallOpeningArea, wallTotalOpeningArea);
}
示例6: SetParameters
private void SetParameters(Wall wall, IEnumerable<RevitParameter> parameters, Document doc)
{
foreach (RevitParameter rp in parameters)
{
try
{
Parameter p = wall.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 = wall.WallType.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);
}
}
}
}
示例7: Recognization
public static bool Recognization(RichWall richWall)
{
_wall = richWall.wall;
_finishType = richWall.finishType;
_length = _wall.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble();
_level_bottom =
_doc.GetElement(_wall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsElementId()) as Level;
_level_top =
_doc.GetElement(_wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).AsElementId()) as Level;
_offset_bottom = _wall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
_offset_top = _wall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).AsDouble();
_noConsHeight = _wall.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM).AsDouble();
_direction = GetWallDirection(_wall);
if (_direction == Direction.Undefined)
{
_abandonWriter.WriteAbandonment(_wall, AbandonmentTable.SkewWall);
return false;
}
return true;
}
示例8: SetParameters
private void SetParameters(Wall wall, IEnumerable<RevitParameter> parameters, Document doc)
{
foreach (RevitParameter rp in parameters)
{
try
{
Parameter p = wall.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 = wall.WallType.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)
//.........这里部分代码省略.........