本文整理汇总了C#中FamilySymbol类的典型用法代码示例。如果您正苦于以下问题:C# FamilySymbol类的具体用法?C# FamilySymbol怎么用?C# FamilySymbol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FamilySymbol类属于命名空间,在下文中一共展示了FamilySymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DuplicateTypeForm
private FrameTypesMgr m_typesMgr; // object manage FamilySymbols
#endregion Fields
#region Constructors
/// <summary>
/// constructor
/// </summary>
/// <param name="obj">FamilySymbol object</param>
/// <param name="typesMgr">FamilySymbols' manager</param>
public DuplicateTypeForm(object obj, FrameTypesMgr typesMgr)
{
InitializeComponent();
m_copiedSymbol = obj as FamilySymbol;
m_typesMgr = typesMgr;
}
示例2: CreateSchemeAndStoreData
// Create a data structure, attach it to a wall, populate it with data, and retrieve the data back from the wall
public void CreateSchemeAndStoreData(FamilySymbol titleblock)
{
SchemaBuilder schemaBuilder = new SchemaBuilder(new Guid("1a68d420-96dd-44aa-a1de-000774a6104b"));
schemaBuilder.SetReadAccessLevel(AccessLevel.Public); // allow anyone to read the object
schemaBuilder.SetSchemaName("TitleBlockSettings");
// create a field to store data
FieldBuilder fieldBuilder_titleblockName = schemaBuilder.AddSimpleField("titleblockName", typeof(string));
FieldBuilder fieldBuilder_cellSizeDistance_X = schemaBuilder.AddSimpleField("cellSizeDistance_X", typeof(string));
//fieldBuilder_cellSizeDistance_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_X = schemaBuilder.AddSimpleField("lowerGap_X", typeof(string));
//fieldBuilder_lowerGap_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_X = schemaBuilder.AddSimpleField("additionalEdge_X", typeof(string));
//fieldBuilder_additionalEdge_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_X = schemaBuilder.AddSimpleField("fineTune_X", typeof(string));
//fieldBuilder_fineTune_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellSizeDistance_Y = schemaBuilder.AddSimpleField("cellSizeDistance_Y", typeof(string));
//fieldBuilder_cellSizeDistance_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_Y = schemaBuilder.AddSimpleField("lowerGap_Y", typeof(string));
//fieldBuilder_lowerGap_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_Y = schemaBuilder.AddSimpleField("additionalEdge_Y", typeof(string));
//fieldBuilder_additionalEdge_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_Y = schemaBuilder.AddSimpleField("fineTune_Y", typeof(string));
//fieldBuilder_fineTune_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellGrid_Length = schemaBuilder.AddSimpleField("cellGrid_Length", typeof(string));
FieldBuilder fieldBuilder_cellGrid_Height = schemaBuilder.AddSimpleField("cellGrid_Height", typeof(string));
//fieldBuilder.SetDocumentation("store length of cell size in X direction.");
Schema schema = schemaBuilder.Finish(); // register the Schema object
}
示例3: getFamilySymbol
public FamilySymbol getFamilySymbol(string familyname)
{
foreach (FamilySymbol fs in titleBlockList)
{
if (familyname == fs.Name)
{
familySymbol = fs;
return familySymbol;
}
}
return familySymbol;
}
示例4: IsColumnRound
// works in Revit Structure 2009 API, but not in 2010:
bool IsColumnRound(
FamilySymbol symbol)
{
GenericFormSet solid = symbol.Family.SolidForms;
GenericFormSetIterator i = solid.ForwardIterator();
i.MoveNext();
Extrusion extr = i.Current as Extrusion;
CurveArray cr = extr.Sketch.CurveLoop;
CurveArrayIterator i2 = cr.ForwardIterator();
i2.MoveNext();
String s = i2.Current.GetType().ToString();
return s.Contains( "Arc" );
}
示例5: OfFamilyType
public static IList<Element> OfFamilyType(FamilySymbol familyType)
{
var instanceFilter = new ElementClassFilter(typeof(Autodesk.Revit.DB.FamilyInstance));
var fec = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument);
var familyInstances = fec.WherePasses(instanceFilter)
.WhereElementIsNotElementType()
.ToElements()
.Cast<Autodesk.Revit.DB.FamilyInstance>()
.Where(x => x.Symbol.IsSimilarType(familyType.InternalFamilySymbol.Id));
var instances = familyInstances
.Select(x => ElementSelector.ByElementId(x.Id.IntegerValue)).ToList();
return instances;
}
示例6: FrameTypeParameters
/// <summary>
/// constructor used only for object factory
/// </summary>
/// <param name="symbol">FamilySymbol object has parameters</param>
private FrameTypeParameters(FamilySymbol symbol)
{
// iterate and initialize parameters
foreach (Parameter para in symbol.Parameters)
{
if (para.Definition.Name == "h")
{
m_hDimension = para;
continue;
}
if (para.Definition.Name == "b")
{
m_bDimension = para;
continue;
}
}
}
示例7: PlaceColumn
/// <summary>
/// create column of certain type in certain position
/// </summary>
/// <param name="point2D">2D coordinate of the column</param>
/// <param name="columnType">type of column</param>
/// <param name="baseLevel">the base level of the column</param>
/// <param name="topLevel">the top level of the column</param>
private void PlaceColumn(Autodesk.Revit.DB.UV point2D, FamilySymbol columnType, Level baseLevel, Level topLevel)
{
//create column of certain type in certain level and start point
Autodesk.Revit.DB.XYZ point = new Autodesk.Revit.DB.XYZ (point2D.U, point2D.V, 0);
STRUCTURALTYPE structuralType;
structuralType = Autodesk.Revit.DB.Structure.StructuralType.Column;
FamilyInstance column = m_revit.ActiveUIDocument.Document.Create.NewFamilyInstance(point, columnType, topLevel, structuralType);
//set base level & top level of the column
if (null != column)
{
Parameter baseLevelParameter = column.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.FAMILY_BASE_LEVEL_PARAM);
Parameter topLevelParameter = column.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.FAMILY_TOP_LEVEL_PARAM);
Parameter topOffsetParameter = column.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM);
Parameter baseOffsetParameter = column.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM);
if (null != baseLevelParameter)
{
Autodesk.Revit.DB.ElementId baseLevelId;
baseLevelId = baseLevel.Id;
baseLevelParameter.Set(baseLevelId);
}
if (null != topLevelParameter)
{
Autodesk.Revit.DB.ElementId topLevelId;
topLevelId = topLevel.Id;
topLevelParameter.Set(topLevelId);
}
if (null != topOffsetParameter)
{
topOffsetParameter.Set(0.0);
}
if (null != baseOffsetParameter)
{
baseOffsetParameter.Set(0.0);
}
}
}
示例8: FrameWall
FrameWall( Autodesk.Revit.ApplicationServices.Application rvtApp, Autodesk.Revit.DB.Wall wall, double spacing, FamilySymbol columnType )
{
Document rvtDoc = wall.Document;
LocationCurve loc = (LocationCurve) wall.Location;
XYZ startPt = loc.Curve.GetEndPoint( 0 );
XYZ endPt = loc.Curve.GetEndPoint( 1 );
UV wallVec = new UV( endPt.X - startPt.X, endPt.Y - startPt.Y );
UV axis = new UV( 1.0, 0.0 );
ElementId baseLevelId = wall.get_Parameter( BuiltInParameter.WALL_BASE_CONSTRAINT ).AsElementId();
ElementId topLevelId = wall.get_Parameter( BuiltInParameter.WALL_HEIGHT_TYPE ).AsElementId();
double wallLength = VecLength( wallVec );
wallVec = VecNormalise( wallVec );
int nmax = (int) ( wallLength / spacing );
MessageBox.Show( "Wall Length = " + wallLength + "\nSpacing = " + spacing + "\nMax Number = " + nmax, "Structural Sample", MessageBoxButtons.OK, MessageBoxIcon.Information );
double angle = VecAngle( wallVec, axis );
XYZ loc2 = startPt;
double dx = wallVec.U * spacing;
double dy = wallVec.V * spacing;
for( int i = 0; i < nmax; i++ )
{
PlaceColumn( rvtApp, rvtDoc, loc2, angle, columnType, baseLevelId, topLevelId );
loc2 = new XYZ( startPt.X + dx, startPt.Y + dy, startPt.Z );
}
PlaceColumn( rvtApp, rvtDoc, endPt, angle, columnType, baseLevelId, topLevelId );
}
示例9: PlaceColumn
PlaceColumn( Autodesk.Revit.ApplicationServices.Application rvtApp, Document rvtDoc, Autodesk.Revit.DB.XYZ point2, double angle, FamilySymbol columnType, ElementId baseLevelId, ElementId topLevelId )
{
Autodesk.Revit.DB.XYZ point = point2;
// Note: Must use level-hosted NewFamilyInstance!
Level instLevel = (Level) rvtDoc.GetElement( baseLevelId );
Autodesk.Revit.DB.FamilyInstance column = rvtDoc.Create.NewFamilyInstance( point, columnType, instLevel, StructuralType.Column );
if( column == null )
{
MessageBox.Show( "failed to create an instance of a column." );
return;
}
Autodesk.Revit.DB.XYZ zVec = new Autodesk.Revit.DB.XYZ( 0, 0, 1 );
Autodesk.Revit.DB.Line axis = Line.CreateUnbound( point, zVec );
column.Location.Rotate( axis, angle );
// Set the level Ids
Parameter baseLevelParameter = column.get_Parameter( Autodesk.Revit.DB.BuiltInParameter.FAMILY_BASE_LEVEL_PARAM );
Parameter topLevelParameter = column.get_Parameter( Autodesk.Revit.DB.BuiltInParameter.FAMILY_TOP_LEVEL_PARAM ); ;
baseLevelParameter.Set( baseLevelId );
topLevelParameter.Set( topLevelId );
}
示例10: SetTitleBlock
SetTitleBlock(string name)
{
foreach (FamilySymbol f in m_allTitleBlocks) {
if (name.Equals(f.Name)) {
m_titleBlock = f;
return;
}
}
}
示例11: GetTitleBlocks
GetTitleBlocks(Document doc)
{
m_allTitleBlocks = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_TitleBlocks).Cast<FamilySymbol>() as List<FamilySymbol>;
if (0 == m_allTitleBlocks.Count) {
throw new Exception("There is no title block to generate sheet.");
}
foreach (FamilySymbol f in m_allTitleBlocks) {
m_titleBlockNames.Add(f.Name);
if (null == m_titleBlock) {
m_titleBlock = f;
}
}
}
示例12: _getParam
private static FScheme.Value _getParam(FamilySymbol fi, Parameter p)
{
if (p.StorageType == StorageType.Double)
{
return FScheme.Value.NewNumber(p.AsDouble());
}
else if (p.StorageType == StorageType.Integer)
{
return FScheme.Value.NewNumber(p.AsInteger());
}
else if (p.StorageType == StorageType.String)
{
return FScheme.Value.NewString(p.AsString());
}
else
{
return FScheme.Value.NewContainer(p.AsElementId());
}
}
示例13: GetTitleBlocks
/// <summary>
/// Retrieve all available title blocks in the currently active document.
/// </summary>
/// <param name="doc">the currently active document</param>
private void GetTitleBlocks(Document doc)
{
m_allTitleBlocks = doc.TitleBlocks;
if (0 == m_allTitleBlocks.Size)
{
throw new InvalidOperationException("There is no title block to generate sheet.");
}
foreach (FamilySymbol f in m_allTitleBlocks)
{
AllTitleBlocksNames.Add(f.Name);
if (null == m_titleBlock)
{
m_titleBlock = f;
}
}
}
示例14: makeFamilyInstance
private Value makeFamilyInstance(object location, FamilySymbol fs, int count)
{
XYZ pos = location is ReferencePoint
? (location as ReferencePoint).Position
: (XYZ) location;
FamilyInstance fi;
if (this.Elements.Count > count)
{
if (dynUtils.TryGetElement(this.Elements[count], out fi))
{
fi.Symbol = fs;
LocationPoint lp = fi.Location as LocationPoint;
lp.Point = pos;
}
else
{
fi = this.UIDocument.Document.IsFamilyDocument
? this.UIDocument.Document.FamilyCreate.NewFamilyInstance(
pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural
)
: this.UIDocument.Document.Create.NewFamilyInstance(
pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural
);
this.Elements[count] = fi.Id;
}
}
else
{
fi = this.UIDocument.Document.IsFamilyDocument
? this.UIDocument.Document.FamilyCreate.NewFamilyInstance(
pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural)
: this.UIDocument.Document.Create.NewFamilyInstance(
pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
this.Elements.Add(fi.Id);
}
return Value.NewContainer(fi);
}
示例15: GetMinSymbolHeight
/// <summary>
/// Gets minimum height of a family symbol.
/// </summary>
/// <param name="symbol">
/// The family symbol.
/// </param>
static double GetMinSymbolHeight(FamilySymbol symbol)
{
return ExporterIFCUtils.GetMinSymbolHeight(symbol);
}