Buckets:
| // | |
| // (C) Copyright 2003-2019 by Autodesk, Inc. | |
| // | |
| // Permission to use, copy, modify, and distribute this software in | |
| // object code form for any purpose and without fee is hereby granted, | |
| // provided that the above copyright notice appears in all copies and | |
| // that both that copyright notice and the limited warranty and | |
| // restricted rights notice below appear in all supporting | |
| // documentation. | |
| // | |
| // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. | |
| // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF | |
| // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. | |
| // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE | |
| // UNINTERRUPTED OR ERROR FREE. | |
| // | |
| // Use, duplication, or disclosure by the U.S. Government is subject to | |
| // restrictions set forth in FAR 52.227-19 (Commercial Computer | |
| // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) | |
| // (Rights in Technical Data and Computer Software), as applicable. | |
| // | |
| namespace Revit.SDK.Samples.CreateBeamSystem.CS | |
| { | |
| using System; | |
| using System.Text; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.ComponentModel; | |
| using Autodesk.Revit; | |
| using Autodesk.Revit.DB; | |
| /// <summary> | |
| /// describes the type of beam layout method in beam system | |
| /// </summary> | |
| public enum LayoutMethod | |
| { | |
| /// <summary> | |
| /// the beam's layout method in beam System is clear the spacing among beams | |
| /// </summary> | |
| ClearSpacing, | |
| /// <summary> | |
| /// maximum the space among beams | |
| /// </summary> | |
| MaximumSpacing, | |
| /// <summary> | |
| /// has fixed beams number and user appoint the number | |
| /// </summary> | |
| FixedNumber, | |
| /// <summary> | |
| /// has fixed distance among beams and user appoint this distance | |
| /// </summary> | |
| FixedDistance | |
| } | |
| /// <summary> | |
| /// declares a delegate for a method that takes in a LayoutMethod | |
| /// </summary> | |
| /// <param name="layoutMethod"></param> | |
| public delegate void LayoutRuleChangedHandler(ref LayoutMethod layoutMethod); | |
| /// <summary> | |
| /// the properties of beam system; | |
| /// can be displayed in PropertyGrid | |
| /// </summary> | |
| public abstract class BeamSystemParam | |
| { | |
| /// <summary> | |
| /// layout method | |
| /// </summary> | |
| protected LayoutMethod m_layoutType; | |
| /// <summary> | |
| /// space between beams; buffer for subclass | |
| /// </summary> | |
| protected double m_fixedSpacing; | |
| /// <summary> | |
| /// justify type; buffer for subclass | |
| /// </summary> | |
| protected BeamSystemJustifyType m_justifyType; | |
| /// <summary> | |
| /// number of beams | |
| /// </summary> | |
| protected int m_numberOfLines; | |
| private LayoutRuleChangedHandler m_layoutRuleChanged; | |
| private FamilySymbol m_beamType; // beam type of beam system | |
| /// <summary> | |
| /// layout method of beam system is changed | |
| /// </summary> | |
| [] | |
| public LayoutRuleChangedHandler LayoutRuleChanged | |
| { | |
| get | |
| { | |
| return m_layoutRuleChanged; | |
| } | |
| set | |
| { | |
| m_layoutRuleChanged = value; | |
| } | |
| } | |
| /// <summary> | |
| /// kind of layout rule | |
| /// </summary> | |
| [ | |
| ] | |
| public LayoutMethod LayoutRuleMethod | |
| { | |
| get | |
| { | |
| return m_layoutType; | |
| } | |
| set | |
| { | |
| if (m_layoutType != value) | |
| { | |
| // invokes the delegate | |
| LayoutRuleChanged(ref value); | |
| } | |
| } | |
| } | |
| /// <summary> | |
| /// type of beam used to create beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public FamilySymbol BeamType | |
| { | |
| get | |
| { | |
| return m_beamType; | |
| } | |
| set | |
| { | |
| m_beamType = value; | |
| } | |
| } | |
| /// <summary> | |
| /// initial general members for its subclass | |
| /// </summary> | |
| protected BeamSystemParam() | |
| { | |
| m_fixedSpacing = 2000.0; | |
| m_justifyType = BeamSystemJustifyType.Center; | |
| m_numberOfLines = 6; | |
| } | |
| /// <summary> | |
| /// create BeamSystemParam's subclass according to LayoutMethod | |
| /// </summary> | |
| /// <param name="layoutType">LayoutMethod</param> | |
| /// <returns>created BeamSystemParam's subclass</returns> | |
| public static BeamSystemParam CreateInstance(LayoutMethod layoutType) | |
| { | |
| BeamSystemParam param = null; | |
| switch (layoutType) | |
| { | |
| case LayoutMethod.ClearSpacing: | |
| param = new ClearSpacingParam(); | |
| break; | |
| case LayoutMethod.FixedDistance: | |
| param = new FixedDistanceParam(); | |
| break; | |
| case LayoutMethod.FixedNumber: | |
| param = new FixedNumberParam(); | |
| break; | |
| case LayoutMethod.MaximumSpacing: | |
| param = new MaximumSpacingParam(); | |
| break; | |
| default: | |
| break; | |
| } | |
| // it is absolutely impossible unless layoutType is wrong | |
| Debug.Assert(null != param); | |
| return param; | |
| } | |
| /// <summary> | |
| /// clone BeamSystemParam to one of its subclass according to LayoutMethod | |
| /// </summary> | |
| /// <param name="layoutType">LayoutMethod</param> | |
| /// <returns>cloned BeamSystemParam's subclass</returns> | |
| public BeamSystemParam CloneInstance(LayoutMethod layoutType) | |
| { | |
| // create a BeamSystemParam instance and set its properties | |
| BeamSystemParam param = CreateInstance(layoutType); | |
| param.m_fixedSpacing = m_fixedSpacing; | |
| param.m_justifyType = m_justifyType; | |
| param.m_numberOfLines = m_numberOfLines; | |
| param.m_beamType = m_beamType; | |
| return param; | |
| } | |
| /// <summary> | |
| /// subclass of LayoutRule | |
| /// </summary> | |
| [] | |
| public abstract LayoutRule Layout | |
| { | |
| get; | |
| } | |
| /// <summary> | |
| /// properties related to LayoutRule when it's clear spacing | |
| /// only visible for class BeamSystemParam | |
| /// </summary> | |
| class ClearSpacingParam : BeamSystemParam, IDisposable | |
| { | |
| protected LayoutRuleClearSpacing m_layout; | |
| /// <summary> | |
| /// wrapped LayoutRuleClearSpacing object | |
| /// </summary> | |
| public override LayoutRule Layout | |
| { | |
| get | |
| { | |
| return m_layout; | |
| } | |
| } | |
| /// <summary> | |
| /// FixedSpacing value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public double ClearSpacing | |
| { | |
| get | |
| { | |
| return m_fixedSpacing; | |
| } | |
| set | |
| { | |
| try | |
| { | |
| m_layout.Spacing = value; | |
| m_fixedSpacing = value; | |
| } | |
| catch | |
| { | |
| } | |
| } | |
| } | |
| /// <summary> | |
| /// JustifyType value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public BeamSystemJustifyType JustifyType | |
| { | |
| get | |
| { | |
| return m_justifyType; | |
| } | |
| set | |
| { | |
| m_layout.JustifyType = value; | |
| m_justifyType = value; | |
| } | |
| } | |
| /// <summary> | |
| /// constructor | |
| /// </summary> | |
| public ClearSpacingParam() | |
| : base() | |
| { | |
| m_layout = new LayoutRuleClearSpacing(m_fixedSpacing, m_justifyType); | |
| m_layoutType = LayoutMethod.ClearSpacing; | |
| } | |
| protected virtual void Dispose(bool disposing) | |
| { | |
| if (disposing) | |
| { | |
| if (m_layout != null) | |
| m_layout.Dispose(); | |
| } | |
| } | |
| public void Dispose() | |
| { | |
| Dispose(disposing: true); | |
| GC.SuppressFinalize(this); | |
| } | |
| } | |
| /// <summary> | |
| /// properties related to LayoutRule when it's fixed distance | |
| /// only visible for class BeamSystemParam | |
| /// </summary> | |
| class FixedDistanceParam : BeamSystemParam, IDisposable | |
| { | |
| protected LayoutRuleFixedDistance m_layout; | |
| /// <summary> | |
| /// wrapped LayoutRuleFixedDistance object | |
| /// </summary> | |
| public override LayoutRule Layout | |
| { | |
| get | |
| { | |
| return m_layout; | |
| } | |
| } | |
| /// <summary> | |
| /// constructor | |
| /// </summary> | |
| public FixedDistanceParam() | |
| : base() | |
| { | |
| m_layout = new LayoutRuleFixedDistance(m_fixedSpacing, m_justifyType); | |
| m_layoutType = LayoutMethod.FixedDistance; | |
| } | |
| /// <summary> | |
| /// FixedSpacing value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public double FixedSpacing | |
| { | |
| get | |
| { | |
| return m_fixedSpacing; | |
| } | |
| set | |
| { | |
| try | |
| { | |
| m_layout.Spacing = value; | |
| m_fixedSpacing = value; | |
| } | |
| catch | |
| { | |
| } | |
| } | |
| } | |
| /// <summary> | |
| /// JustifyType value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public BeamSystemJustifyType JustifyType | |
| { | |
| get | |
| { | |
| return m_justifyType; | |
| } | |
| set | |
| { | |
| m_layout.JustifyType = value; | |
| m_justifyType = value; | |
| } | |
| } | |
| protected virtual void Dispose(bool disposing) | |
| { | |
| if (disposing) | |
| { | |
| if (m_layout != null) | |
| m_layout.Dispose(); | |
| } | |
| } | |
| public void Dispose() | |
| { | |
| Dispose(disposing: true); | |
| GC.SuppressFinalize(this); | |
| } | |
| } | |
| /// <summary> | |
| /// properties related to LayoutRule when it's fixed number | |
| /// only visible for class BeamSystemParam | |
| /// </summary> | |
| class FixedNumberParam : BeamSystemParam, IDisposable | |
| { | |
| protected LayoutRuleFixedNumber m_layout; | |
| /// <summary> | |
| /// NumberOfLines value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public int NumberOfLines | |
| { | |
| get | |
| { | |
| return m_numberOfLines; | |
| } | |
| set | |
| { | |
| try | |
| { | |
| m_layout.NumberOfLines = value; | |
| m_numberOfLines = value; | |
| } | |
| catch | |
| { | |
| } | |
| } | |
| } | |
| /// <summary> | |
| /// wrapped LayoutRuleFixedNumber object | |
| /// </summary> | |
| public override LayoutRule Layout | |
| { | |
| get | |
| { | |
| return m_layout; | |
| } | |
| } | |
| /// <summary> | |
| /// constructor | |
| /// </summary> | |
| public FixedNumberParam() | |
| : base() | |
| { | |
| m_layout = new LayoutRuleFixedNumber(m_numberOfLines); | |
| m_layoutType = LayoutMethod.FixedNumber; | |
| } | |
| protected virtual void Dispose(bool disposing) | |
| { | |
| if (disposing) | |
| { | |
| if (m_layout != null) | |
| m_layout.Dispose(); | |
| } | |
| } | |
| public void Dispose() | |
| { | |
| Dispose(disposing: true); | |
| GC.SuppressFinalize(this); | |
| } | |
| } | |
| /// <summary> | |
| /// properties related to LayoutRule when it's maximum spacing | |
| /// only visible for class BeamSystemParam | |
| /// </summary> | |
| class MaximumSpacingParam : BeamSystemParam, IDisposable | |
| { | |
| protected LayoutRuleMaximumSpacing m_layout; | |
| /// <summary> | |
| /// FixedSpacing value of beam system | |
| /// </summary> | |
| [ | |
| ] | |
| public double MaximumSpacing | |
| { | |
| get | |
| { | |
| return m_fixedSpacing; | |
| } | |
| set | |
| { | |
| try | |
| { | |
| m_layout.Spacing = value; | |
| m_fixedSpacing = value; | |
| } | |
| catch | |
| { | |
| } | |
| } | |
| } | |
| /// <summary> | |
| /// wrapped LayoutRuleMaximumSpacing object | |
| /// </summary> | |
| public override LayoutRule Layout | |
| { | |
| get | |
| { | |
| return m_layout; | |
| } | |
| } | |
| /// <summary> | |
| /// constructor | |
| /// </summary> | |
| public MaximumSpacingParam() | |
| : base() | |
| { | |
| m_layout = new LayoutRuleMaximumSpacing(m_fixedSpacing); | |
| m_layoutType = LayoutMethod.MaximumSpacing; | |
| } | |
| protected virtual void Dispose(bool disposing) | |
| { | |
| if (disposing) | |
| { | |
| if (m_layout != null) | |
| m_layout.Dispose(); | |
| } | |
| } | |
| public void Dispose() | |
| { | |
| Dispose(disposing: true); | |
| GC.SuppressFinalize(this); | |
| } | |
| } | |
| } | |
| } | |
Xet Storage Details
- Size:
- 16.4 kB
- Xet hash:
- ed3e4e3a700e9695dd8f18b7b5d127b741d162430e42aee58060c2c5bb8c2d25
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.