Ejemplo n.º 1
0
        public void AdjustColumnTypeName(FamilySymbol colSymbol)
        {
            double colHeight, colWidth, colDiameter;
            string colMat;

            string targetColumnTypeName;

            if (colSymbol.Family.Name.Equals(Default.FAMILY_NAME_RECT_COLUMN))
            {
                GetRectColumnSymbolProperties(colSymbol, out colMat, out colHeight, out colWidth);

                string matSign = RvtMaterial.GetMatSyntaxe(colMat);

                targetColumnTypeName = $"{Default.SYNT_COLUMN}-{matSign}-{colWidth}x{colHeight}";
            }
            else
            {
                GetRondColumnSymbolProperties(colSymbol, out colMat, out colDiameter);

                string matSign = RvtMaterial.GetMatSyntaxe(colMat);

                targetColumnTypeName = $"{Default.SYNT_COLUMN}-{matSign}-D{colDiameter}";
            }

            if (!colSymbol.Name.Equals(targetColumnTypeName))
            {
                Transaction t = new Transaction(_doc);
                t.Start("Change column type name");
                colSymbol.Name = targetColumnTypeName;
                t.Commit();
            }
        }
Ejemplo n.º 2
0
        public FamilySymbol GetBeamFamilyTypeOrCreateNew(string beamSign, string beamMat, double beamHeight, double beamWidth)
        {
            string synthaxe = BeamType.GetSyntaxe(beamSign);
            string matSign  = RvtMaterial.GetMatSyntaxe(beamMat);

            string targetBeamTypeName = $"{synthaxe}-{matSign}-{beamWidth}x{beamHeight}";

            // find the family type for beam creation
            FamilySymbol beamSymbol = GetFamilySymbolByName(_doc, BuiltInCategory.OST_StructuralFraming, targetBeamTypeName);

            // if family type exists, adjust its properties
            if (beamSymbol != null)
            {
                AdjustBeamTypeProperties(beamSymbol);
            }
            // if family type doesn't exist in the project, create a new one
            else
            {
                if (null != _family)
                {
                    System.Diagnostics.Debug.Print("Family name={0}", _family.Name);

                    FamilySymbol s = null;
                    foreach (ElementId id in _family.GetFamilySymbolIds())
                    {
                        s = _doc.GetElement(id) as FamilySymbol;
                        break;
                    }
                    System.Diagnostics.Debug.Assert(null != s,
                                                    "expected at least one symbol"
                                                    + " to be defined in family");
                    Transaction t = new Transaction(_doc);
                    t.Start("Create new family type");

                    beamSymbol = s.Duplicate("InitialName") as FamilySymbol;

                    SetDoubleValueTo(
                        beamSymbol, Default.PARA_NAME_DIM_HEIGHT,
                        UnitUtils.Convert(beamHeight, DisplayUnitType.DUT_CENTIMETERS, DisplayUnitType.DUT_DECIMAL_FEET));

                    SetDoubleValueTo(
                        beamSymbol, Default.PARA_NAME_DIM_WIDTH,
                        UnitUtils.Convert(beamWidth, DisplayUnitType.DUT_CENTIMETERS, DisplayUnitType.DUT_DECIMAL_FEET));

                    SetStringValueTo(beamSymbol, Default.PARA_NAME_BEAM_TYPE, beamSign);

                    Material targetMaterial = GetMaterialByName(_doc, beamMat);

                    SetElementIdValueTo(beamSymbol, Default.PARA_NAME_STR_MATERIAL, targetMaterial.Id);

                    beamSymbol.Name = targetBeamTypeName;
                    t.Commit();

                    BeamTypesList.Add(beamSymbol);
                }
            }

            return(beamSymbol);
        }
Ejemplo n.º 3
0
        public void AdjustBeamTypeName(FamilySymbol beamSymbol)
        {
            double beamHeight, beamWidth;
            string beamSign, beamMat;

            GetBeamSymbolProperties(beamSymbol, out beamSign, out beamMat, out beamHeight, out beamWidth);

            string synthaxe = BeamType.GetSyntaxe(beamSign);
            string matSign  = RvtMaterial.GetMatSyntaxe(beamMat);

            string targetBeamTypeName = $"{synthaxe}-{matSign}-{beamWidth}x{beamHeight}";

            if (!beamSymbol.Name.Equals(targetBeamTypeName))
            {
                Transaction t = new Transaction(_doc);
                t.Start("Change beam type name");
                beamSymbol.Name = targetBeamTypeName;
                t.Commit();
            }
        }
Ejemplo n.º 4
0
        public void AdjustWallTypeName(WallType wallType)
        {
            double wallThickness;
            string wallMat;
            bool   isStructural;

            GetWallTypeProperties(wallType, out isStructural, out wallMat, out wallThickness);
            if (isStructural)
            {
                string matSign = RvtMaterial.GetMatSyntaxe(wallMat);

                string targetWallTypeName = $"{Default.SYNT_WALL}-{matSign}-EP{wallThickness}";

                if (!wallType.Name.Equals(targetWallTypeName))
                {
                    Transaction t = new Transaction(_doc);
                    t.Start("Change wall type name");
                    wallType.Name = targetWallTypeName;
                    t.Commit();
                }
            }
        }