├── D4ASCopyright.docx ├── tools └── Extra │ ├── W16_DYNADST_launch.ico │ ├── DynamoAdvanceSteel.cuix │ └── DynamoAdvanceSteel.xml ├── src ├── .editorconfig ├── ContentBuilder │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── App.config │ ├── Program.cs │ ├── ContentBuilder.csproj │ └── DocClasses.cs ├── AdvanceSteelServices │ ├── IContextManager.cs │ ├── AsServices.csproj.vspscc │ ├── IAppInteraction.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── DisposeLogic.cs │ ├── DocContext.cs │ ├── SerializableHandle.cs │ ├── ElementBinder.cs │ ├── AdvanceSteelServices.csproj │ ├── AppResolver.cs │ └── LifecycleManager.cs ├── AdvanceSteelNodes │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── base │ │ ├── SteelDynObject.cs │ │ ├── GraphicObject.cs │ │ └── SteelDbObject.cs │ ├── Util │ │ ├── Material.cs │ │ ├── BeamSection.cs │ │ ├── SelectionFilter.cs │ │ └── UserAttribute.cs │ ├── Grating │ │ ├── GratingDraw.cs │ │ └── BarGrating.cs │ ├── AdvanceSteelNodes.csproj │ └── ConnectionObjects │ │ ├── WeldLine.cs │ │ ├── WeldPoint.cs │ │ └── ConnectionObject.cs ├── AdvanceSteelNodesUI │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Base │ │ └── AstDropDownBase.cs │ ├── SteelElements │ │ ├── ASPropertiesPlate.cs │ │ ├── ASPropertiesGrating.cs │ │ ├── ASPropertiesSlab.cs │ │ ├── ASPropertiesWall.cs │ │ ├── ASPropertiesBentBeam.cs │ │ ├── ASPropertiesPolyBeam.cs │ │ ├── ASPropertiesTaperedBeam.cs │ │ ├── ASPropertiesStraightBeam.cs │ │ ├── ASPropertiesUnfoldedBeam.cs │ │ ├── ASPropertiesConcBentBeam.cs │ │ ├── ASObjectTypes.cs │ │ ├── ASPropertiesIsolatedFooting.cs │ │ ├── ASPropertiesConcStraightBeam.cs │ │ ├── ASPropertiesCompoundStraightBeam.cs │ │ └── BeamRefAxisTypeDropDown.cs │ ├── Miscellaneous │ │ ├── ASPropertiesCamera.cs │ │ ├── ASPropertiesSpecialParts.cs │ │ ├── BodyResolution.cs │ │ ├── ASSelectObjectTypes.cs │ │ ├── SteelSelection.cs │ │ └── ASobjectSelection.cs │ ├── Features │ │ ├── ASPropertiesHoles.cs │ │ ├── ASPropertiesBeamNotchSqFeatures.cs │ │ ├── ASPropertiesPlateVertexFeatures.cs │ │ ├── ASPropertiesBeamCutPlaneFeatures.cs │ │ ├── ASPropertiesBeamNotchExFeatures.cs │ │ ├── ASPropertiesBeamPolylineNotchFeatures.cs │ │ ├── ASPropertiesPlatePolylineNotchFeatures.cs │ │ ├── HoleDirectionDropDown.cs │ │ ├── PlateFilletVertexTypeDropDown.cs │ │ └── HoleTypeDropDown.cs │ ├── ConnectionObjects │ │ ├── WeldConnectionTypeDropDown.cs │ │ ├── ASPropertiesWeldLine.cs │ │ ├── ASPropertiesShearStuds.cs │ │ ├── ASPropertiesWeldPoint.cs │ │ ├── ASPropertiesAnchorBolt.cs │ │ ├── ASPropertiesMidScrewBoltPattern.cs │ │ ├── ASPropertiesCircleScrewBoltPattern.cs │ │ ├── BoltConnectionTypeDropDown.cs │ │ └── AnchorOrientationTypeDropDown.cs │ └── AdvanceSteelNodesUI.csproj ├── AssemblySharedInfoGenerator │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── AssemblyInfoGenerator.csproj │ └── AssemblySharedInfo.tt ├── DynamoAdvanceSteel │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SteelAppResolver.cs │ ├── SchedulerThread.cs │ ├── RibbonUtils.cs │ ├── OneTransactionPerContext.cs │ ├── SteelAppInteraction.cs │ ├── WorkspaceMigrations.cs │ ├── DynamoSteelModel.cs │ ├── DynamoSteelApp.cs │ ├── OneTransactionPerAllContexts.cs │ ├── SteelAuthProvider.cs │ ├── PathResolver.cs │ └── DynamoAdvanceSteel.csproj ├── Config │ ├── user_local.props │ ├── CS.props │ └── Install.props ├── DynamoAdvanceSteelInstall.sln ├── DynamoAdvanceSteelInstall │ ├── DirectoryTree.wxs │ ├── Product.wxs │ └── DynamoAdvanceSteelInstall.wixproj ├── transform_all.bat └── DynamoAdvanceSteel.sln ├── Directory.Build.props ├── .gitignore └── readme.md /D4ASCopyright.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DynamoDS/Dynamo-Advance-Steel/HEAD/D4ASCopyright.docx -------------------------------------------------------------------------------- /tools/Extra/W16_DYNADST_launch.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DynamoDS/Dynamo-Advance-Steel/HEAD/tools/Extra/W16_DYNADST_launch.ico -------------------------------------------------------------------------------- /tools/Extra/DynamoAdvanceSteel.cuix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DynamoDS/Dynamo-Advance-Steel/HEAD/tools/Extra/DynamoAdvanceSteel.cuix -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | # To learn more about .editorconfig see https://aka.ms/editorconfigdocs 2 | 3 | [*.{cs,csx,vb,vbx}] 4 | indent_style = space 5 | indent_size = 2 6 | tab_width = 2 7 | 8 | -------------------------------------------------------------------------------- /src/ContentBuilder/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("ContentBuilder")] 5 | [assembly: AssemblyCulture("")] 6 | [assembly: Guid("7BD2BAB8-FACE-4058-BE0F-C1906276B74C")] -------------------------------------------------------------------------------- /src/AdvanceSteelServices/IContextManager.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Dynamo.Applications.AdvanceSteel.Services 3 | { 4 | public interface IContextManager 5 | { 6 | void EnsureInContext(DocContext ctx); 7 | void LeaveContext(DocContext ctx); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ContentBuilder/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(SolutionDir)..\bin\$(Platform)\$(Configuration)\int\ 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dll 2 | *.pdb 3 | *.cache 4 | *.wixobj 5 | Temporary*.* 6 | 7 | # User-specific files 8 | *.suo 9 | *.db 10 | *.sdf 11 | *.user 12 | *.mnr 13 | *.exe 14 | *.msi 15 | src/AssemblySharedInfoGenerator/AssemblySharedInfo.cs 16 | src/.vs/ 17 | 18 | # Folders 19 | [Bb]in/ 20 | [Oo]bj/ 21 | [Ll]og/ -------------------------------------------------------------------------------- /src/AdvanceSteelServices/AsServices.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AdvanceSteelNodes")] 8 | [assembly: AssemblyCulture("")] 9 | [assembly: Guid("A03C641C-D7A6-43B3-A40B-CC4AE4414073")] -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AdvanceSteelNodesUI")] 8 | [assembly: AssemblyCulture("")] 9 | [assembly: Guid("907B9532-7437-441A-8EF7-744D34A73B2F")] -------------------------------------------------------------------------------- /src/AssemblySharedInfoGenerator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("AssemblyInfoGenerator")] 9 | [assembly: AssemblyCulture("")] 10 | [assembly: Guid("ee3f94ae-5b7c-4853-a26b-082ece99ed66")] -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("DynamoAdvanceSteel")] 8 | 9 | // The following GUID is for the ID of the typelib if this project is exposed to COM 10 | [assembly: Guid("7649e0ff-ebed-4cee-9b0b-f74c3649590b")] -------------------------------------------------------------------------------- /tools/Extra/DynamoAdvanceSteel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DynamoAdvanceSteel.dll 7 | DynamoAdvanceSteel.cuix 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/IAppInteraction.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.DotNetRoots.Units; 2 | using Autodesk.AdvanceSteel.Geometry; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Dynamo.Applications.AdvanceSteel.Services 7 | { 8 | public interface IAppInteraction 9 | { 10 | event EventHandler DocumentOpened; 11 | UnitsSet DbUnits { get; } 12 | IEnumerable PickElements(); 13 | IEnumerable GetCurrentSelection(); 14 | void ExecuteOnIdle(Action a); 15 | Point3d PickPoint(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Config/user_local.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | D:\DynamoCoreRuntime3.4.2 5 | C:\Program Files\Autodesk\AutoCAD 2026\ADVS 6 | C:\Program Files\Autodesk\AutoCAD 2026 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AdvanceSteelServices")] 9 | [assembly: AssemblyCulture("")] 10 | [assembly: Guid("E8A8CD40-6E78-4C8C-9992-2346D09DF866")] 11 | [assembly: InternalsVisibleTo("DynamoSteelTests")] -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/SteelAppResolver.cs: -------------------------------------------------------------------------------- 1 | using Dynamo.Applications.AdvanceSteel.Services; 2 | 3 | namespace Dynamo.Applications.AdvanceSteel 4 | { 5 | public class SteelAppResolver : AppResolver 6 | { 7 | public override T ResolveType() 8 | { 9 | if (typeof(T) == typeof(IContextManager)) 10 | return new OneTransactionPerAllContexts() as T; 11 | //return new OneTransactionPerContext() as T; 12 | 13 | if (typeof(T) == typeof(IAppInteraction)) 14 | return new SteelAppInteraction() as T; 15 | 16 | return null; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Base/AstDropDownBase.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.DesignScript.Runtime; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Newtonsoft.Json; 5 | using System.Collections.Generic; 6 | 7 | namespace AdvanceSteel.Nodes 8 | { 9 | public abstract class AstDropDownBase : DSDropDownBase 10 | { 11 | protected AstDropDownBase(string value) : base(value) 12 | { 13 | } 14 | 15 | [JsonConstructor] 16 | public AstDropDownBase(string value, IEnumerable inPorts, IEnumerable outPorts) : base(value, inPorts, outPorts) 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/base/SteelDynObject.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.DesignScript.Interfaces; 2 | using Autodesk.DesignScript.Runtime; 3 | using System; 4 | using Dynamo.Applications.AdvanceSteel.Services; 5 | 6 | namespace AdvanceSteel.Nodes 7 | { 8 | /// 9 | /// This is the equivalent of an Advance Steel object in Dynamo 10 | /// 11 | [IsVisibleInDynamoLibrary(false)] 12 | public abstract class SteelDynObject : IDisposable, IFormattable 13 | { 14 | [IsVisibleInDynamoLibrary(false)] 15 | public abstract void Dispose(); 16 | 17 | 18 | [IsVisibleInDynamoLibrary(false)] 19 | public override string ToString() 20 | { 21 | return GetType().Name; 22 | } 23 | 24 | public virtual string ToString(string format, IFormatProvider formatProvider) 25 | { 26 | return ToString(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/AdvanceSteelServices/DisposeLogic.cs: -------------------------------------------------------------------------------- 1 | namespace Dynamo.Applications.AdvanceSteel.Services 2 | { 3 | public static class DisposeLogic 4 | { 5 | /// 6 | /// This flag is set to true in the event that you want to 7 | /// notify IDisposable objects whether Dynamo is shutting down. 8 | /// Ex. When shutting down Advance Steel, we set IsShuttingDown to true, 9 | /// and we read this flag in the Dispose method. For AbstractElement 10 | /// elements this allows us to bypass cleanup of Advance Steel elements. 11 | /// 12 | public static bool IsShuttingDown { get; set; } 13 | 14 | /// 15 | /// This flag is set to true when Dynamo is going to close 16 | /// current home workspace and set to false when home workspace is 17 | /// removed. 18 | /// 19 | public static bool IsClosingHomeworkspace { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ContentBuilder/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Reflection; 5 | 6 | namespace ContentBuilder 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | if (args.Length != 2) 13 | { 14 | Console.WriteLine("Expect:"); 15 | Console.WriteLine("1. directory path to generated XML Documentation files"); 16 | Console.WriteLine("2. full path to .md file to update"); 17 | return; 18 | } 19 | 20 | string strFullAssemblyDocDir = args[0]; // full path to assembly documentation file ( xml) 21 | string strFullDocName = args[1]; // full path to .md that will be created 22 | 23 | 24 | var nodes = NodeParser.GetNodesFromAssemblies(new string[] { "AdvanceSteelNodes.dll", "AdvanceSteelNodesUI.dll" }); 25 | MDGenerator.GenerateFromAssembly(strFullAssemblyDocDir, nodes, strFullDocName); 26 | 27 | 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/SchedulerThread.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AutoCAD.ApplicationServices.Core; 2 | using Dynamo.Scheduler; 3 | using System; 4 | 5 | namespace Dynamo.Applications.AdvanceSteel 6 | { 7 | /// 8 | /// class used to execute dynamo tasks in AutoCAD application context 9 | /// 10 | public class SchedulerThread : ISchedulerThread 11 | { 12 | private IScheduler Scheduler; 13 | 14 | public void Initialize(IScheduler owningScheduler) 15 | { 16 | Scheduler = owningScheduler; 17 | Application.Idle += Application_Idle; 18 | } 19 | 20 | private void Application_Idle(object sender, EventArgs e) 21 | { 22 | Application.DocumentManager.ExecuteInApplicationContext(ExecuteInApplicationContextCallback, null); 23 | } 24 | 25 | public void ExecuteInApplicationContextCallback(object userData) 26 | { 27 | while (Scheduler.ProcessNextTask(false)) 28 | { 29 | } 30 | } 31 | 32 | public void Shutdown() 33 | { 34 | Application.Idle -= Application_Idle; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/AdvanceSteelServices/DocContext.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.DocumentManagement; 2 | using System; 3 | using System.Reflection; 4 | 5 | namespace Dynamo.Applications.AdvanceSteel.Services 6 | { 7 | /// 8 | /// Used to manage the transactions while accessing Advance Steel objects 9 | /// 10 | public class DocContext : IDisposable 11 | { 12 | private bool readOnly = false; 13 | 14 | public DocContext(bool readOnly = false) 15 | { 16 | this.readOnly = readOnly; 17 | Manager.EnsureInContext(this); 18 | } 19 | 20 | public void Dispose() 21 | { 22 | Manager.LeaveContext(this); 23 | } 24 | public static IContextManager Manager 25 | { 26 | get 27 | { 28 | if (manager == null) 29 | { 30 | manager = AppResolver.Resolve(); 31 | } 32 | 33 | return manager; 34 | } 35 | } 36 | 37 | public bool ReadOnly 38 | { 39 | get 40 | { 41 | return readOnly; 42 | } 43 | set 44 | { 45 | readOnly = value; 46 | } 47 | } 48 | 49 | private static IContextManager manager; 50 | } 51 | } -------------------------------------------------------------------------------- /src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true 7 | true 8 | false 9 | {133FC760-5699-46D9-BEA6-E816B5F01016} 10 | false 11 | 12 | 13 | "$(SolutionDir)transform_all.bat" "$(MSBuildProjectDirectory)" 14 | 15 | 16 | 17 | True 18 | True 19 | AssemblySharedInfo.tt 20 | 21 | 22 | 23 | 24 | TextTemplatingFileGenerator 25 | AssemblySharedInfo.cs 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteelInstall.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.705 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "DynamoAdvanceSteelInstall", "DynamoAdvanceSteelInstall\DynamoAdvanceSteelInstall.wixproj", "{C7495640-0D0C-46AB-A5F3-D5BE78F89A0D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C7495640-0D0C-46AB-A5F3-D5BE78F89A0D}.Debug|x86.ActiveCfg = Debug|x86 15 | {C7495640-0D0C-46AB-A5F3-D5BE78F89A0D}.Debug|x86.Build.0 = Debug|x86 16 | {C7495640-0D0C-46AB-A5F3-D5BE78F89A0D}.Release|x86.ActiveCfg = Release|x86 17 | {C7495640-0D0C-46AB-A5F3-D5BE78F89A0D}.Release|x86.Build.0 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {E83005B6-2B1A-46F5-8C69-9E1CA73DBC86} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/RibbonUtils.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.Windows; 2 | using System.Runtime.Versioning; 3 | 4 | namespace Dynamo.Applications.AdvanceSteel 5 | { 6 | [SupportedOSPlatform("windows")] 7 | public class RibbonUtils 8 | { 9 | public static string DynamoASTabUID = "Add-ins"; 10 | public static string DynamoASPanelUID = "ID_PanelOnlineDocuments"; 11 | public static string DynamoASButtonUID = "DYNAMOAS"; 12 | 13 | public static void SetEnabled(string tabName, string panelUID, string buttonUID, bool enabled) 14 | { 15 | RibbonTabCollection oTabs = Autodesk.Windows.ComponentManager.Ribbon.Tabs; 16 | foreach (RibbonTab oTab in oTabs) 17 | { 18 | if (oTab.Title == tabName) 19 | { 20 | RibbonPanelCollection bPans = oTab.Panels; 21 | 22 | foreach (RibbonPanel oPanel in bPans) 23 | { 24 | if (oPanel.UID == panelUID) 25 | { 26 | foreach (RibbonItem item in oPanel.Source.Items) 27 | { 28 | if (item.UID == buttonUID) 29 | { 30 | item.IsEnabled = enabled; 31 | } 32 | } 33 | } 34 | } 35 | break; 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/AdvanceSteelServices/SerializableHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Dynamo.Applications.AdvanceSteel.Services 9 | { 10 | /// 11 | /// Holds a representation of a AutoCAD Handle that supports serialization 12 | /// 13 | [Serializable] 14 | public class SerializableHandle : ISerializable 15 | { 16 | public string Handle { get; set; } 17 | 18 | public SerializableHandle() 19 | { 20 | Handle = ""; 21 | } 22 | 23 | /// 24 | /// Ctor used by the serialization engine 25 | /// 26 | /// 27 | /// 28 | public SerializableHandle(SerializationInfo info, StreamingContext context) 29 | { 30 | Handle = (string)info.GetValue("Handle", typeof(string)); 31 | } 32 | /// 33 | /// Populates a System.Runtime.Serialization.SerializationInfo with the data needed 34 | /// 35 | /// 36 | /// 37 | public void GetObjectData(SerializationInfo info, StreamingContext context) 38 | { 39 | info.AddValue("Handle", Handle, typeof(string)); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/ElementBinder.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.CADAccess; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace Dynamo.Applications.AdvanceSteel.Services 6 | { 7 | /// 8 | /// Tools to handle the binding and interaction 9 | /// 10 | public class ElementBinder 11 | { 12 | //maybe we need a separate key for Advance Steel 13 | //for the moment dynamo is using only this hardcoded key (see ..\Dynamo\src\Engine\ProtoCore\Lang\TraceUtils.cs) 14 | private const string REVIT_TRACE_ID = "{0459D869-0C72-447F-96D8-08A7FB92214B}-REVIT"; 15 | 16 | public static string GetHandleFromTrace() 17 | { 18 | string traceData = DynamoServices.TraceUtils.GetTraceData(REVIT_TRACE_ID); 19 | 20 | if (traceData == null) 21 | return null; //There was no usable data in the trace cache 22 | 23 | return traceData; 24 | } 25 | 26 | public static void SetElementForTrace(string handle) 27 | { 28 | DynamoServices.TraceUtils.SetTraceData(REVIT_TRACE_ID, handle); 29 | } 30 | 31 | public static void CleanupAndSetElementForTrace(FilerObject newElement) 32 | { 33 | if (newElement == null) return; 34 | 35 | var oldHandle = GetHandleFromTrace(); 36 | if (oldHandle != null && oldHandle != newElement.Handle) 37 | { 38 | //right now do not delete anything 39 | // 40 | } 41 | 42 | SetElementForTrace(newElement.Handle); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/OneTransactionPerContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Dynamo.Applications.AdvanceSteel.Services; 7 | using Autodesk.AdvanceSteel.DocumentManagement; 8 | 9 | namespace Dynamo.Applications.AdvanceSteel 10 | { 11 | public class OneTransactionPerContext : IContextManager 12 | { 13 | private Autodesk.AdvanceSteel.CADAccess.Transaction SteelTransaction = null; 14 | private bool DocumentLocked = false; 15 | 16 | public void EnsureInContext(DocContext ctx) 17 | { 18 | if (SteelTransaction != null || DocumentLocked == true) 19 | throw new System.Exception("Nested context"); 20 | 21 | DocumentLocked = DocumentManager.LockCurrentDocument(); 22 | 23 | if (DocumentLocked == true) 24 | { 25 | SteelTransaction = Autodesk.AdvanceSteel.CADAccess.TransactionManager.StartTransaction(); 26 | } 27 | 28 | if (DocumentLocked == false || SteelTransaction == null) 29 | { 30 | throw new System.Exception("Failed to access Document"); 31 | } 32 | } 33 | 34 | public void LeaveContext(DocContext ctx) 35 | { 36 | if (SteelTransaction != null) 37 | { 38 | SteelTransaction.Commit(); 39 | SteelTransaction = null; 40 | } 41 | 42 | if (DocumentLocked == true) 43 | { 44 | DocumentLocked = DocumentManager.UnlockCurrentDocument(); 45 | DocumentLocked = false; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Util/Material.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.CADAccess; 2 | using Autodesk.AdvanceSteel.ConstructionTypes; 3 | using System; 4 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 5 | 6 | namespace AdvanceSteel.Nodes.Util 7 | { 8 | /// 9 | /// This node can be used to assign Material to Advance Steel elements from Dynamo 10 | /// 11 | public class Material 12 | { 13 | internal Material() 14 | { 15 | } 16 | /// 17 | /// This node can set the Material for Advance Steel elements from Dynamo 18 | /// 19 | /// Advance Steel element 20 | /// Material 21 | /// 22 | [Obsolete("Material.SetMaterial is obsolete. Please use Property.ByNameAndValue with name \"Material\" and the desired material value, followed by Property.SetObjectProperty.")] 23 | public static void SetMaterial(AdvanceSteel.Nodes.SteelDbObject element, string materialName) 24 | { 25 | //lock the document and start transaction 26 | using (var ctx = new SteelServices.DocContext()) 27 | { 28 | string handle = element.Handle; 29 | 30 | FilerObject obj = Utils.GetObject(handle); 31 | 32 | if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kAtomicElem)) 33 | { 34 | AtomicElement atomic = obj as AtomicElement; 35 | atomic.Material = materialName; 36 | } 37 | else 38 | throw new System.Exception("Failed to set material"); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/ContentBuilder/ContentBuilder.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6} 7 | Exe 8 | false 9 | MSB3277 10 | 11 | 12 | 13 | $(DYNAMOAPI)\Newtonsoft.Json.dll 14 | False 15 | 16 | 17 | $(DYNAMOAPI)\nodes\CoreNodeModels.dll 18 | False 19 | 20 | 21 | $(DYNAMOAPI)\nodes\CoreNodeModelsWpf.dll 22 | False 23 | 24 | 25 | $(DYNAMOAPI)\DynamoApplications.dll 26 | False 27 | 28 | 29 | $(DYNAMOAPI)\DynamoCore.dll 30 | False 31 | 32 | 33 | $(DYNAMOAPI)\DynamoServices.dll 34 | False 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Grating/GratingDraw.cs: -------------------------------------------------------------------------------- 1 | using AdvanceSteel.Nodes.Plates; 2 | using Autodesk.AdvanceSteel.CADAccess; 3 | using Autodesk.DesignScript.Runtime; 4 | using DynGeometry = Autodesk.DesignScript.Geometry; 5 | using SteelGeometry = Autodesk.AdvanceSteel.Geometry; 6 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 7 | using System.Collections.Generic; 8 | using Autodesk.AdvanceSteel.Geometry; 9 | using System.Linq; 10 | using System; 11 | 12 | namespace AdvanceSteel.Nodes.Gratings 13 | { 14 | [IsVisibleInDynamoLibrary(false)] 15 | public static class GratingDraw 16 | { 17 | public static List GetPointsToDraw(Autodesk.AdvanceSteel.Modelling.Grating grating) 18 | { 19 | var coordSystem = grating.CS; 20 | coordSystem.GetCoordSystem(out var origPt, out var vX, out var vY, out var vZ); 21 | 22 | var temp1 = vY * grating.Width / 2.0; 23 | var temp2 = vX * grating.Length / 2.0; 24 | 25 | var pt1 = new SteelGeometry.Point3d(grating.CenterPoint); 26 | pt1.Add(temp1 + temp2); 27 | 28 | var pt2 = new SteelGeometry.Point3d(grating.CenterPoint); 29 | pt2.Add(temp1 - temp2); 30 | 31 | var pt3 = new SteelGeometry.Point3d(grating.CenterPoint); 32 | pt3.Add(-temp1 - temp2); 33 | 34 | var pt4 = new SteelGeometry.Point3d(grating.CenterPoint); 35 | pt4.Add(-temp1 + temp2); 36 | 37 | 38 | List polyPoints = new List 39 | { 40 | Utils.ToDynPoint(pt1, true), 41 | Utils.ToDynPoint(pt2, true), 42 | Utils.ToDynPoint(pt3, true), 43 | Utils.ToDynPoint(pt4, true) 44 | }; 45 | 46 | return polyPoints; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteelInstall/DirectoryTree.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/AdvanceSteelServices.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {00ED013F-0B34-4A79-9760-A21FD14D4BD5} 7 | Dynamo.Applications.AdvanceSteel.Services 8 | false 9 | MSB3277 10 | 11 | 12 | 13 | $(ADVANCESTEELAPI)\ASCADLinkMgd.dll 14 | False 15 | 16 | 17 | $(ADVANCESTEELAPI)\ASObjectsMgd.dll 18 | False 19 | 20 | 21 | $(ADVANCESTEELAPI)\Extensions\DotNetRoots.dll 22 | False 23 | 24 | 25 | $(ADVANCESTEELAPI)\ASGeometryMgd.dll 26 | False 27 | 28 | 29 | $(DYNAMOAPI)\DynamoServices.dll 30 | False 31 | 32 | 33 | $(DYNAMOAPI)\DynamoCore.dll 34 | False 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/transform_all.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETLOCAL ENABLEDELAYEDEXPANSION 3 | 4 | :: set the working dir (default to current dir) 5 | set wdir=%cd% 6 | if not (%1)==() set wdir=%1 7 | 8 | :: set the file extension (default to vb) 9 | set extension=cs 10 | if not (%2)==() set extension=%2 11 | 12 | echo executing transform_all from %wdir% 13 | pushd %wdir% 14 | :: create a list of all the T4 templates in the working dir 15 | dir *.tt /b > t4list.txt 16 | 17 | echo the following T4 templates will be transformed: 18 | type t4list.txt 19 | 20 | :: Use texttransform.exe from the IDE if it is present, otherwise, use legacy locations. 21 | 22 | :: clear text transform path to undefine it 23 | set TEXTTRANSFORMPATH= 24 | 25 | :: use latest vswhere utility to locate in IDE, where it resides now. 26 | IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( 27 | for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -all`) do ( 28 | if /i "%%i" == "installationPath" set TEXTTRANSFORMPATH="%%j\Common7\IDE\TextTransform.exe" 29 | ) 30 | ) 31 | 32 | :: not found in IDE, use legacy 33 | IF NOT DEFINED TEXTTRANSFORMPATH ( 34 | set TEXTTRANSFORMPATH="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\%VisualStudioVersion%\TextTransform.exe" 35 | ) 36 | 37 | :: transform all the templates 38 | for /f %%d in (t4list.txt) do ( 39 | set file_name=%%d 40 | set file_name=!file_name:~0,-3!.%extension% 41 | echo: \--^> !file_name! 42 | echo %TEXTTRANSFORMPATH% -out !file_name! %%d 43 | %TEXTTRANSFORMPATH% -out !file_name! %%d 44 | ) 45 | 46 | :: delete T4 list and return to previous directory 47 | del t4list.txt 48 | popd 49 | 50 | echo transformation complete -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/SteelAppInteraction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Dynamo.Applications.AdvanceSteel.Services; 7 | using Autodesk.AdvanceSteel.DocumentManagement; 8 | using Autodesk.AdvanceSteel.CADAccess; 9 | using Autodesk.AdvanceSteel.CADLink.Database; 10 | using Autodesk.AdvanceSteel.Geometry; 11 | 12 | namespace Dynamo.Applications.AdvanceSteel 13 | { 14 | class SteelAppInteraction : IAppInteraction 15 | { 16 | public Autodesk.AdvanceSteel.DotNetRoots.Units.UnitsSet DbUnits 17 | { 18 | get { return DocumentManager.GetCurrentDocument().CurrentDatabase.Units; } 19 | } 20 | 21 | public event EventHandler DocumentOpened; 22 | 23 | public void ExecuteOnIdle(Action a) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public IEnumerable GetCurrentSelection() 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | 33 | public Point3d PickPoint() 34 | { 35 | return UserInteraction.GetPoint("Pick Point: ", 1); 36 | } 37 | 38 | 39 | public IEnumerable PickElements() 40 | { 41 | List ret = new List() { }; 42 | 43 | using (var ctx = new DocContext()) 44 | { 45 | List OIDx = UserInteraction.SelectObjects(); 46 | if (OIDx.Count > 0) 47 | { 48 | for (int i = 0; i < OIDx.Count; i++) 49 | { 50 | FilerObject obj = FilerObject.GetFilerObject(OIDx[i]); 51 | if (obj != null) 52 | { 53 | ret.Add(obj.Handle); 54 | } 55 | } 56 | } 57 | } 58 | return ret; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/WorkspaceMigrations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml; 4 | using Dynamo.Migration; 5 | using Dynamo.Models; 6 | using Dynamo.Utilities; 7 | 8 | namespace Dynamo.Migration.AdvanceSteel 9 | { 10 | public class WorkspaceMigrations 11 | { 12 | [WorkspaceMigration("0.8.1.0", "1.0.0.0")] 13 | public static void Migrate_0_8_1_to_1_0_0_0(XmlDocument doc) 14 | { 15 | XmlNodeList elNodes = doc.GetElementsByTagName("Elements"); 16 | 17 | if (elNodes.Count == 0) 18 | elNodes = doc.GetElementsByTagName("dynElements"); 19 | 20 | var elementsRoot = elNodes[0]; 21 | 22 | var corrections = new List>(); 23 | 24 | foreach (XmlElement elNode in elementsRoot.ChildNodes) 25 | { 26 | if (elNode.Name == "Dynamo.Nodes.DSFunction" && elNode.Attributes["assembly"].Value == "AsNodes.dll") 27 | { 28 | XmlElement newNode = elNode.Clone() as XmlElement; 29 | 30 | string oldFunction = elNode.Attributes["function"].Value; 31 | string newFunction = oldFunction.Replace("AdvanceSteel.Nodes.StraightBeam", "AdvanceSteel.Nodes.Beams.StraightBeam"); 32 | newFunction = newFunction.Replace("AdvanceSteel.Nodes.BentBeam", "AdvanceSteel.Nodes.Beams.BentBeam"); 33 | 34 | newNode.SetAttribute("assembly", "AdvanceSteelNodes.dll"); 35 | newNode.SetAttribute("function", newFunction); 36 | corrections.Add(new Tuple(newNode, elNode)); 37 | } 38 | 39 | } 40 | 41 | foreach (var correction in corrections) 42 | { 43 | elementsRoot.InsertBefore(correction.Item1, correction.Item2); 44 | elementsRoot.RemoveChild(correction.Item2); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/AppResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Dynamo.Applications.AdvanceSteel.Services 8 | { 9 | public abstract class AppResolver 10 | { 11 | public abstract T ResolveType() where T : class; 12 | public static T Resolve() where T : class 13 | { 14 | return Instance.ResolveType(); 15 | } 16 | 17 | internal static AppResolver Instance 18 | { 19 | get 20 | { 21 | if (inst == null) 22 | { 23 | string appName = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName.ToLower(); 24 | switch (appName) 25 | { 26 | case "revit.exe": 27 | { 28 | inst = Activator.CreateInstance("DynamoSteelRevit", "Dynamo.Applications.AdvanceSteel.RevitAppResolver").Unwrap() as AppResolver; 29 | break; 30 | } 31 | case "acad.exe": 32 | { 33 | inst = Activator.CreateInstance("DynamoAdvanceSteel", "Dynamo.Applications.AdvanceSteel.SteelAppResolver").Unwrap() as AppResolver; 34 | break; 35 | } 36 | case "vstest.executionengine.exe": 37 | case "testhost.exe": 38 | { 39 | inst = Activator.CreateInstance("DynamoSteelTests", "DynamoSteelTests.TestsAppResolver").Unwrap() as AppResolver; 40 | break; 41 | } 42 | default: 43 | { 44 | break; 45 | } 46 | } 47 | } 48 | 49 | return inst; 50 | } 51 | set 52 | { 53 | inst = value; 54 | } 55 | } 56 | 57 | private static AppResolver inst; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/DynamoSteelModel.cs: -------------------------------------------------------------------------------- 1 | using Dynamo.Graph.Workspaces; 2 | using Dynamo.Migration.AdvanceSteel; 3 | using Dynamo.Models; 4 | using System.Runtime.Versioning; 5 | 6 | namespace Dynamo.Applications.AdvanceSteel 7 | { 8 | [SupportedOSPlatform("windows")] 9 | public class DynamoSteelModel : DynamoModel 10 | { 11 | public new static DynamoSteelModel Start(IStartConfiguration configuration) 12 | { 13 | if (string.IsNullOrEmpty(configuration.Context)) 14 | configuration.Context = "Advance Steel"; 15 | 16 | return new DynamoSteelModel(configuration); 17 | } 18 | 19 | private DynamoSteelModel(IStartConfiguration configuration) : 20 | base(configuration) 21 | { 22 | Services.DisposeLogic.IsShuttingDown = false; 23 | 24 | MigrationManager.MigrationTargets.Add(typeof(WorkspaceMigrations)); 25 | //SetupPython(); 26 | } 27 | 28 | protected override void ShutDownCore(bool shutdownHost) 29 | { 30 | Services.DisposeLogic.IsShuttingDown = true; 31 | //Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.DocumentActivationEnabled = true; 32 | 33 | base.ShutDownCore(shutdownHost); 34 | 35 | RibbonUtils.SetEnabled(RibbonUtils.DynamoASTabUID, RibbonUtils.DynamoASPanelUID, RibbonUtils.DynamoASButtonUID, true); 36 | } 37 | 38 | protected override void OnWorkspaceRemoveStarted(WorkspaceModel workspace) 39 | { 40 | base.OnWorkspaceRemoveStarted(workspace); 41 | 42 | if (workspace is HomeWorkspaceModel) 43 | Services.DisposeLogic.IsClosingHomeworkspace = true; 44 | } 45 | 46 | protected override void OnWorkspaceRemoved(WorkspaceModel workspace) 47 | { 48 | base.OnWorkspaceRemoved(workspace); 49 | 50 | if (workspace is HomeWorkspaceModel) 51 | Services.DisposeLogic.IsClosingHomeworkspace = false; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Dynamo Extension for Advance Steel 2 | 3 | This repository contains the source files for the Dynamo Extension for Advance Steel. 4 | 5 | **Dynamo Extension for Advance Steel** has different branches for different versions of Advance Steel. For example, to run it on Advance Steel 2020 you must use **AS2020_2.1.0** branch. 6 | 7 | ## How to build and use this extension: 8 | 9 | 1. Prerequisites needed: 10 | - Advance Steel 2026; 11 | - Visual Studio 2022; 12 | - Dynamo Core 3.4.2 runtime from http://www.github.com/DynamoDS/Dynamo; 13 | - .NET 8 SDK from https://dotnet.microsoft.com/download/visual-studio-sdks 14 | 1. Update the paths from [`\src\Config\user_local.props`](/src/Config/user_local.props) with the ones on your machine 15 | 1. Build the DynamoAdvanceSteel.sln solution in Release configuration. 16 | 1. Copy all files and folders from "Dynamo Core 3.0.3" build to .\bin\AnyCPU\Release\steel-pkg\bin\Core 17 | 1. (Optional) On Windows 10 version 1709 and later, run the the PowerShell command `Get-ChildItem *.* -Recurse | Unblock-File` inside .\bin\AnyCPU\Release\steel-pkg\bin\Core otherwise Dynamo can fail to load under Advance Steel. This is due to newer Windows blocking .NET assemblies downloaded from the internet. 18 | 1. Register DynamoAdvanceSteel.dll as an addon for Advance Steel (see "Register addon" section from Advance Steel [online help](https://help.autodesk.com/view/ADSTPR/2024/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075#GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075__SECTION_7F1482FDAB9845CC8CEAB9D042201C2A)) 19 | 20 | ## To build the installer: 21 | 22 | 1. Prerequisites needed: 23 | - Wix v3.11 or newer; 24 | 1. Build DynamoAdvanceSteel.sln solution in Release configuration; 25 | 1. Build DynamoAdvanceSteelInstall.sln solution in Release configuration; 26 | 27 | ## List of available nodes: 28 | 29 | Click [here](nodes.md) to view the list of the available dynamo-advance steel nodes 30 | -------------------------------------------------------------------------------- /src/Config/CS.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net8.0-windows 8 | $(SolutionDir)..\bin\$(Platform)\$(Configuration)\steel-pkg\bin\ 9 | $(BaseIntermediateOutputPath) 10 | false 11 | x64 12 | 512 13 | true 14 | full 15 | false 16 | DEBUG;TRACE 17 | prompt 18 | 4 19 | en-US 20 | 21 | 22 | net8.0-windows 23 | $(SolutionDir)..\bin\$(Platform)\$(Configuration)\steel-pkg\bin\ 24 | $(BaseIntermediateOutputPath) 25 | false 26 | x64 27 | 512 28 | pdbonly 29 | true 30 | TRACE 31 | prompt 32 | 4 33 | en-US 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteelInstall/Product.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2026 9 | 10 | 11 | 12 | 13 | 1 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Config/Install.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10.0 8 | $(MSBuildProjectDirectory)\bin\$(Platform)\$(Configuration) 9 | $(OutputPath)..\..\..\..\.. 10 | $(SolutionDir).. 11 | $(SolutionDir)\..\samples 12 | $(InstallOutputPath)\int\ 13 | true 14 | full 15 | false 16 | DEBUG;TRACE 17 | prompt 18 | 4 19 | 20 | 21 | 10.0 22 | $(MSBuildProjectDirectory)\bin\$(Platform)\$(Configuration) 23 | $(OutputPath)..\..\..\..\.. 24 | $(SolutionDir).. 25 | $(SolutionDir)\..\samples 26 | $(InstallOutputPath)\int\ 27 | pdbonly 28 | true 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesPlate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PlateProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Plate")] 12 | [NodeCategory("AdvanceSteel.Nodes.Plates")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesPlate : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesPlate() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesPlate(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetPlatePropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/base/GraphicObject.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.DesignScript.Interfaces; 2 | using Autodesk.DesignScript.Runtime; 3 | using System.Collections.Generic; 4 | 5 | namespace AdvanceSteel.Nodes 6 | { 7 | /// 8 | /// This represents the Advance Steel Objects as graphical objects 9 | /// 10 | [IsVisibleInDynamoLibrary(false)] 11 | public abstract class GraphicObject : SteelDbObject, IGraphicItem 12 | { 13 | private const byte DefR = 101; 14 | private const byte DefG = 86; 15 | private const byte DefB = 130; 16 | private const byte DefA = 255; 17 | 18 | public virtual Autodesk.DesignScript.Geometry.Curve GetDynCurve() { return null; } 19 | public virtual IEnumerable GetDynGeometry() { return new List() { GetDynCurve() }; } 20 | 21 | public new void Tessellate(IRenderPackage package, TessellationParameters parameters) 22 | { 23 | var previousMeshVertexCount = package.MeshVertexCount; 24 | var previousLineVertexCount = package.LineVertexCount; 25 | 26 | foreach (var geometry in GetDynGeometry()) 27 | { 28 | if (geometry == null) 29 | continue; 30 | 31 | geometry.Tessellate(package, parameters); 32 | } 33 | 34 | if (package is IRenderPackageSupplement packageSupplement) 35 | { 36 | int size = (package.MeshVertexCount - previousMeshVertexCount) * 4; 37 | packageSupplement.AddTextureMapForMeshVerticesRange(previousMeshVertexCount, package.MeshVertexCount - 1, CreateColorByteArrayOfSize(size, DefR, DefG, DefB, DefA), size); 38 | 39 | if (package.LineVertexCount > previousLineVertexCount) 40 | { 41 | packageSupplement.UpdateLineVertexColorForRange(previousLineVertexCount, package.LineVertexCount - 1, DefR, DefG, DefB, DefA); 42 | } 43 | } 44 | } 45 | 46 | private static byte[] CreateColorByteArrayOfSize(int size, byte red, byte green, byte blue, byte alpha) 47 | { 48 | var arr = new byte[size * 4]; 49 | for (var i = 0; i < arr.Length; i += 4) 50 | { 51 | arr[i] = red; 52 | arr[i + 1] = green; 53 | arr[i + 2] = blue; 54 | arr[i + 3] = alpha; 55 | } 56 | return arr; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesGrating.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("GratingProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Grating")] 12 | [NodeCategory("AdvanceSteel.Nodes.Grating")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesGrating : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesGrating() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesGrating(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetGratingPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/ASPropertiesCamera.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("CameraProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Camera")] 12 | [NodeCategory("AdvanceSteel.Nodes.Miscellaneous.Camera")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesCamera : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesCamera() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesCamera(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetCameraPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesSlab.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ConcreteSlabProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Concrete Slabs")] 12 | [NodeCategory("AdvanceSteel.Nodes.Concrete.Slabs")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesSlab : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesSlab() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesSlab(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetConcreteSlabProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesWall.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ConcreteWallProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Concrete Wall")] 12 | [NodeCategory("AdvanceSteel.Nodes.Concrete.Walls")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesWall: AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesWall() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesWall(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetConcreteWallProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesBentBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BentBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Bent Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.BentBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBentBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesBentBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesBentBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetBentBeamPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesPolyBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PolyBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Poly Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.PolyBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesPolyBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesPolyBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesPolyBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetPolyBeamPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesTaperedBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("TaperedBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Tapered Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.TaperedBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesTaperedBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesTaperedBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesTaperedBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetTaperBeamPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesStraightBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("StraightBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Straight Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.StraightBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesStraightBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesStraightBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesStraightBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetStraighBeamPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesHoles.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PlateHoleProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Holes")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.PlateHoles")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesHoles : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesHoles() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesHoles(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { };// 41 | foreach (var item in Utils.GetConnectionHolePlatePropertyList()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/ASPropertiesSpecialParts.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("SpecialPartsProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Special Part")] 12 | [NodeCategory("AdvanceSteel.Nodes.Miscellaneous.SpecialPart")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesSpecialParts : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesSpecialParts() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesSpecialParts(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetSpecialPartPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesUnfoldedBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("UnfoldedBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Unfolded Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.UnFoldedBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesUnfoldedBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesUnfoldedBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesUnfoldedBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetUnfoldedStraightBeamProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/WeldConnectionTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | 9 | namespace AdvanceSteel.Nodes 10 | { 11 | [NodeName("WeldConnectionTypes")] 12 | [NodeDescription("Lists the Advance Steel Weld connection type options")] 13 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 14 | [OutPortNames("weldType")] 15 | [OutPortTypes("int")] 16 | [OutPortDescriptions("weld connection type")] 17 | [IsDesignScriptCompatible] 18 | public class WeldConnectionType : AstDropDownBase 19 | { 20 | private const string outputName = "weldType"; 21 | 22 | public WeldConnectionType() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public WeldConnectionType(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() 41 | { 42 | new DynamoDropDownItem("Select Weld Type...", -1L), 43 | new DynamoDropDownItem("OnSite", 0L), 44 | new DynamoDropDownItem("InShop", 2L) 45 | }; 46 | 47 | Items.AddRange(newItems); 48 | 49 | SelectedIndex = 0; 50 | return SelectionState.Restore; 51 | } 52 | 53 | public override IEnumerable BuildOutputAst(List inputAstNodes) 54 | { 55 | if (Items.Count == 0 || 56 | Items[SelectedIndex].Name == "Select Weld Type..." || 57 | SelectedIndex < 0) 58 | { 59 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 60 | } 61 | 62 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 63 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 64 | return new List { assign }; 65 | 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesWeldLine.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("WeldLineProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Weld Lines")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesWeldLine : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesWeldLine() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesWeldLine(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { }; 41 | foreach (var item in Utils.GetWeldLinePropertiesList()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesConcBentBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ConcreteBentBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Concrete Bent Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Concrete.ConcreteBentBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesConcBentBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesConcBentBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesConcBentBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetConcreteBentBeamProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesShearStuds.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ShearStudProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Shear Stud")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesShearStud : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesShearStud() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesShearStud(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { };// 41 | foreach (var item in Utils.GetShearStudPropertyList()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesWeldPoint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("WeldPointProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Weld Points")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesWeldPoint : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesWeldPoint() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesWeldPoint(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { }; 41 | foreach (var item in Utils.GetWeldPointPropertiesList()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesAnchorBolt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("AnchorBoltProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Anchor Bolt")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesAnchorBolt : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesAnchorBolt() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesAnchorBolt(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { }; 41 | foreach (var item in Utils.GetAnchorBoltPropertyList()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASObjectTypes.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | using System; 8 | 9 | namespace AdvanceSteel.Nodes 10 | { 11 | [NodeName("AdvanceSteelObjectTypes")] 12 | [NodeDescription("Lists all the Advance Steel object types")] 13 | [NodeCategory("AdvanceSteel.Nodes.Selection")] 14 | [OutPortNames("objectType")] 15 | [OutPortTypes("int")] 16 | [OutPortDescriptions("advance steel object type")] 17 | [IsDesignScriptCompatible] 18 | public class ASObjecTypes : AstDropDownBase 19 | { 20 | private const string outputName = "objectType"; 21 | 22 | public ASObjecTypes() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASObjecTypes(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List(); 41 | Dictionary filterItems = Utils.GetASObjectFilters(); 42 | foreach (var item in filterItems) 43 | { 44 | newItems.Add(new DynamoDropDownItem(item.Value, (long)item.Key)); 45 | } 46 | 47 | Items.AddRange(newItems); 48 | 49 | SelectedIndex = 0; 50 | return SelectionState.Restore; 51 | } 52 | 53 | public override IEnumerable BuildOutputAst(List inputAstNodes) 54 | { 55 | if (Items.Count == 0 || 56 | Items[SelectedIndex].Name == "Select Object Type..." || 57 | SelectedIndex < 0) 58 | { 59 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 60 | } 61 | 62 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 63 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 64 | return new List { assign }; 65 | 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesBeamNotchSqFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BeamOrthoNotchFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Beam Ortho Notch Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.BeamCope")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBeamNotchSqFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesBeamNotchSqFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesBeamNotchSqFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetBeamNotchOrthoPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesPlateVertexFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PlateVertexFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Plate Vertex Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.PlateVertexCut")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesPlateVertexFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesPlateVertexFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesPlateVertexFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetPlateVertexPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesIsolatedFooting.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ConcreteIsolatedFootingProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Concrete Isolated Footing")] 12 | [NodeCategory("AdvanceSteel.Nodes.Concrete.Footings")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesIsolatedFooting : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesIsolatedFooting() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesIsolatedFooting(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetConcreteIsolatedFootingProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesBeamCutPlaneFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BeamCutPlaneFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Beam Cut Plane Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.BeamPlaneCut")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBeamCutPlaneFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesBeamCutPlaneFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesBeamCutPlaneFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetBeamCutPlanePropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesMidScrewBoltPattern.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("RectangularBoltProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Rectangular Bolt")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects.RectangularBoltPattern")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBolts : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public ASPropertiesBolts() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASPropertiesBolts(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { }; 41 | foreach (var item in Utils.GetMidScrewBoltPattern()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesBeamNotchExFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BeamRotatedNotchFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Beam Rotated Notch Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.BeamCope")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBeamNotchExFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesBeamNotchExFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesBeamNotchExFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetBeamNotchRotatedPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesConcStraightBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("ConcreteStraightBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Concrete Straight Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Concrete.ConcreteStraightBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesConcStraightBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesConcStraightBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesConcStraightBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetConcreteStraightBeamProperties()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/ASPropertiesCompoundStraightBeam.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("CompoundStraightBeamProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Compound Straight Beam")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams.CompoundBeam")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesCompoundStraightBeam : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesCompoundStraightBeam() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesCompoundStraightBeam(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetCompoundStraightBeamPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/ASPropertiesCircleScrewBoltPattern.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("CircularBoltProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Circular Bolt Pattern")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects.CircularBoltPattern")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class CircleScrewBoltPattern : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | //AdvanceSteel.Nodes.Properties 22 | public CircleScrewBoltPattern() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public CircleScrewBoltPattern(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() { }; 41 | foreach (var item in Utils.GetCircleScrewBoltPattern()) 42 | { 43 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 44 | } 45 | Items.AddRange(newItems); 46 | 47 | SelectedIndex = 0; 48 | return SelectionState.Restore; 49 | } 50 | 51 | public override IEnumerable BuildOutputAst(List inputAstNodes) 52 | { 53 | if (Items.Count == 0 || 54 | Items[SelectedIndex].Name == "None" || 55 | SelectedIndex < 0) 56 | { 57 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 58 | } 59 | 60 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 61 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 62 | 63 | return new List { assign }; 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/BoltConnectionTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BoltConnectionTypes")] 11 | [NodeDescription("Lists the Advance Steel Bolt Connection type options")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("boltType")] 14 | [OutPortTypes("int")] 15 | [OutPortDescriptions("bolt connection type")] 16 | [IsDesignScriptCompatible] 17 | public class BoltConnectionType : AstDropDownBase 18 | { 19 | private const string outputName = "boltType"; 20 | 21 | public BoltConnectionType() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public BoltConnectionType(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() 40 | { 41 | new DynamoDropDownItem("Select Bolt Type...", -1L), 42 | new DynamoDropDownItem("OnSite", 0L), 43 | new DynamoDropDownItem("Site Drill", 1L), 44 | new DynamoDropDownItem("InShop", 2L) 45 | }; 46 | 47 | Items.AddRange(newItems); 48 | 49 | SelectedIndex = 0; 50 | return SelectionState.Restore; 51 | } 52 | 53 | public override IEnumerable BuildOutputAst(List inputAstNodes) 54 | { 55 | if (Items.Count == 0 || 56 | Items[SelectedIndex].Name == "Select Bolt Type..." || 57 | SelectedIndex < 0) 58 | { 59 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 60 | } 61 | 62 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 63 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 64 | return new List { assign }; 65 | 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesBeamPolylineNotchFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BeamMultiNotchFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Beam Multi Notch Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.BeamPolycut")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesBeamPolylineNotchFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesBeamPolylineNotchFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesBeamPolylineNotchFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetBeamMultiNotchPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/ASPropertiesPlatePolylineNotchFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PlateNotchContourFeatureProperties")] 11 | [NodeDescription("Lists all the property names of an Advance Steel Plate Notch Contour Feature")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.PlatePolycut")] 13 | [OutPortNames("propertyName")] 14 | [OutPortTypes("string")] 15 | [OutPortDescriptions("name of the selected property")] 16 | [IsDesignScriptCompatible] 17 | public class ASPropertiesPlatePolylineNotchFeatures : AstDropDownBase 18 | { 19 | private const string outputName = "propertyName"; 20 | 21 | public ASPropertiesPlatePolylineNotchFeatures() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public ASPropertiesPlatePolylineNotchFeatures(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() { }; 40 | foreach (var item in Utils.GetPlateNotchContourPropertyList()) 41 | { 42 | newItems.Add(new DynamoDropDownItem(item.Key, item.Value)); 43 | } 44 | Items.AddRange(newItems); 45 | 46 | SelectedIndex = 0; 47 | return SelectionState.Restore; 48 | } 49 | 50 | public override IEnumerable BuildOutputAst(List inputAstNodes) 51 | { 52 | if (Items.Count == 0 || 53 | Items[SelectedIndex].Name == "None" || 54 | SelectedIndex < 0) 55 | { 56 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 57 | } 58 | 59 | var intNode = AstFactory.BuildPrimitiveNodeFromObject((string)Items[SelectedIndex].Name); 60 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 61 | 62 | return new List { assign }; 63 | 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/HoleDirectionDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | 9 | namespace AdvanceSteel.Nodes 10 | { 11 | [NodeName("HoleDirection")] 12 | [NodeDescription("Lists the Advance Steel Slotted Hole Direction options")] 13 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 14 | [OutPortNames("slotDirection")] 15 | [OutPortTypes("int")] 16 | [OutPortDescriptions("slotted hole direciton")] 17 | [IsDesignScriptCompatible] 18 | public class SlotDirection : AstDropDownBase 19 | { 20 | private const string outputName = "slotDirection"; 21 | 22 | public SlotDirection() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public SlotDirection(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() 41 | { 42 | new DynamoDropDownItem("Select Slotted Hole Direction...", -1L), 43 | new DynamoDropDownItem("Arc Along", 2L), 44 | new DynamoDropDownItem("X-Axis", 1L), 45 | new DynamoDropDownItem("Y-Axis", 2L) 46 | }; 47 | 48 | Items.AddRange(newItems); 49 | 50 | SelectedIndex = 0; 51 | return SelectionState.Restore; 52 | } 53 | 54 | public override IEnumerable BuildOutputAst(List inputAstNodes) 55 | { 56 | if (Items.Count == 0 || 57 | Items[SelectedIndex].Name == "Select Slotted Hole Direction..." || 58 | SelectedIndex < 0) 59 | { 60 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 61 | } 62 | 63 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 64 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 65 | return new List { assign }; 66 | 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/BodyResolution.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BodyResolutions")] 11 | [NodeDescription("Lists all options for body resolution")] 12 | [NodeCategory("AdvanceSteel.Nodes.Util.Geometry")] 13 | [OutPortNames("bodyResolution")] 14 | [OutPortTypes("int")] 15 | [OutPortDescriptions("body resolution")] 16 | [IsDesignScriptCompatible] 17 | public class BodyResolution : AstDropDownBase 18 | { 19 | private const string outputName = "bodyResolution"; 20 | 21 | public BodyResolution() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public BodyResolution(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() 40 | { 41 | new DynamoDropDownItem("Select Body Resolution...", -1L), 42 | new DynamoDropDownItem("Normal", 0L), 43 | new DynamoDropDownItem("Detailed", 1L), 44 | new DynamoDropDownItem("Hull", 2L), 45 | new DynamoDropDownItem("UnNotched", 3L) 46 | }; 47 | 48 | Items.AddRange(newItems); 49 | 50 | SelectedIndex = 0; 51 | return SelectionState.Restore; 52 | } 53 | 54 | public override IEnumerable BuildOutputAst(List inputAstNodes) 55 | { 56 | if (Items.Count == 0 || 57 | Items[SelectedIndex].Name == "Select Body Resolution..." || 58 | SelectedIndex < 0) 59 | { 60 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 61 | } 62 | 63 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 64 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 65 | return new List { assign }; 66 | 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/PlateFilletVertexTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("PlateFilletVertexTypes")] 11 | [NodeDescription("Lists the Advance Steel Plate Fillet Vertex type options")] 12 | [NodeCategory("AdvanceSteel.Nodes.Features.PlateVertexCut")] 13 | [OutPortNames("vertexType")] 14 | [OutPortTypes("int")] 15 | [OutPortDescriptions("type of vertex")] 16 | [IsDesignScriptCompatible] 17 | public class PlateFilletVertexType : AstDropDownBase 18 | { 19 | private const string outputName = "vertexType"; 20 | 21 | public PlateFilletVertexType() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public PlateFilletVertexType(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() 40 | { 41 | new DynamoDropDownItem("Select Plate Corener Cut Type...", -1L), 42 | new DynamoDropDownItem("Convex", 0L), 43 | new DynamoDropDownItem("Concave", 1L), 44 | new DynamoDropDownItem("Striaght", 2L) 45 | }; 46 | 47 | Items.AddRange(newItems); 48 | 49 | SelectedIndex = 0; 50 | return SelectionState.Restore; 51 | } 52 | 53 | public override IEnumerable BuildOutputAst(List inputAstNodes) 54 | { 55 | if (Items.Count == 0 || 56 | Items[SelectedIndex].Name == "Select Plate Corener Cut Type..." || 57 | SelectedIndex < 0) 58 | { 59 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 60 | } 61 | 62 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 63 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 64 | return new List { assign }; 65 | 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/AdvanceSteelNodes.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {785BB90B-886C-411D-8D34-8F85E9479A9C} 7 | AdvanceSteel.Nodes 8 | false 9 | $(OutputPath)\AdvanceSteelNodes.xml 10 | MSB3277;CS1591 11 | 12 | 13 | 14 | $(ADVANCESTEELAPI)\ASCADLinkMgd.dll 15 | False 16 | 17 | 18 | $(ADVANCESTEELAPI)\ASGeometryMgd.dll 19 | False 20 | 21 | 22 | $(ADVANCESTEELAPI)\ASModelerMgd.dll 23 | False 24 | 25 | 26 | $(ADVANCESTEELAPI)\ASProfilesMgd.dll 27 | False 28 | 29 | 30 | $(ADVANCESTEELAPI)\ASObjectsMgd.dll 31 | False 32 | 33 | 34 | $(ADVANCESTEELAPI)\Extensions\DotNetRoots.dll 35 | False 36 | 37 | 38 | $(DYNAMOAPI)\DSCoreNodes.dll 39 | False 40 | 41 | 42 | $(DYNAMOAPI)\DynamoServices.dll 43 | False 44 | 45 | 46 | $(DYNAMOAPI)\ProtoGeometry.dll 47 | False 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/base/SteelDbObject.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.DesignScript.Interfaces; 2 | using Autodesk.DesignScript.Runtime; 3 | using System; 4 | using Dynamo.Applications.AdvanceSteel.Services; 5 | 6 | namespace AdvanceSteel.Nodes 7 | { 8 | /// 9 | /// This is the equivalent of an Advance Steel object in Dynamo 10 | /// 11 | [IsVisibleInDynamoLibrary(false)] 12 | public abstract class SteelDbObject : SteelDynObject, IGraphicItem 13 | { 14 | protected string ObjectHandle; 15 | protected static readonly object access_obj = new object(); 16 | internal bool IsOwnedByDynamo = true; 17 | 18 | /// 19 | /// Property that holds the handle of the object 20 | /// 21 | [IsVisibleInDynamoLibrary(false)] 22 | public string Handle 23 | { 24 | get 25 | { 26 | return ObjectHandle; 27 | } 28 | set 29 | { 30 | ObjectHandle = value; 31 | 32 | var elementManager = LifecycleManager.GetInstance(); 33 | elementManager.RegisterAsssociation(ObjectHandle, this); 34 | } 35 | } 36 | 37 | [IsVisibleInDynamoLibrary(false)] 38 | public override void Dispose() 39 | { 40 | lock (access_obj) 41 | { 42 | // Do not cleanup elements if we are shutting down Dynamo. 43 | if (DisposeLogic.IsShuttingDown || DisposeLogic.IsClosingHomeworkspace) 44 | return; 45 | 46 | var elementManager = LifecycleManager.GetInstance(); 47 | 48 | int remainingBindings = elementManager.UnRegisterAssociation(Handle, this); 49 | 50 | // Do not delete owned elements 51 | if (remainingBindings == 0 && IsOwnedByDynamo == true) 52 | { 53 | if (Handle != null) 54 | { 55 | //lock the document and start a transaction 56 | using (var ctx = new DocContext()) 57 | { 58 | var filerObject = Utils.GetObject(Handle); 59 | 60 | if (filerObject != null) 61 | filerObject.DelFromDb(); 62 | 63 | ObjectHandle = string.Empty; 64 | } 65 | } 66 | } 67 | else 68 | { 69 | //This element has gone 70 | ObjectHandle = string.Empty; 71 | } 72 | } 73 | } 74 | 75 | [IsVisibleInDynamoLibrary(false)] 76 | public void Tessellate(IRenderPackage package, TessellationParameters parameters) 77 | { 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/DynamoSteelApp.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.Runtime; 2 | using Autodesk.AdvanceSteel; 3 | using System; 4 | using System.IO; 5 | using System.Reflection; 6 | using Autodesk.AdvanceSteel.ASSettings; 7 | using System.Runtime.Versioning; 8 | 9 | [assembly: ExtensionApplicationAttribute(typeof(Dynamo.Applications.AdvanceSteel.DynamoSteelApp))] 10 | 11 | namespace Dynamo.Applications.AdvanceSteel 12 | { 13 | public sealed class DynamoSteelApp : IExtensionApplication 14 | { 15 | public static string DynamoCorePath = ProductLocator.GetDynamoCorePath(); 16 | #pragma warning disable CA1416 // Validate platform compatibility 17 | public static string ASCInstallPath = ProductLocator.GetASCInstallPath(); 18 | #pragma warning restore CA1416 // Validate platform compatibility 19 | public static Action ShutdownHandler = null; 20 | 21 | void IExtensionApplication.Initialize() 22 | { 23 | SubscribeAssemblyResolvingEvent(); 24 | } 25 | 26 | void IExtensionApplication.Terminate() 27 | { 28 | ShutdownHandler?.Invoke(); 29 | UnsubscribeAssemblyResolvingEvent(); 30 | } 31 | 32 | private void SubscribeAssemblyResolvingEvent() 33 | { 34 | AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; 35 | } 36 | 37 | private void UnsubscribeAssemblyResolvingEvent() 38 | { 39 | AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly; 40 | } 41 | 42 | public static Assembly ResolveAssembly(object sender, ResolveEventArgs args) 43 | { 44 | var assemblyPath = string.Empty; 45 | var assemblyName = new AssemblyName(args.Name).Name + ".dll"; 46 | 47 | try 48 | { 49 | var corePath = DynamoCorePath; 50 | 51 | assemblyPath = Path.Combine(corePath, assemblyName); 52 | 53 | return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); 54 | } 55 | catch (Exception ex) 56 | { 57 | throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); 58 | } 59 | } 60 | } 61 | 62 | internal class ProductLocator 63 | { 64 | public static string GetDynamoCorePath() 65 | { 66 | string currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 67 | return Path.Combine(currentDir, "Core"); 68 | } 69 | 70 | [SupportedOSPlatform("windows")] 71 | public static string GetASCInstallPath() 72 | { 73 | return ASSettingsUtils.GetASCInstallPath(); 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Features/HoleTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | 9 | namespace AdvanceSteel.Nodes 10 | { 11 | [NodeName("HoleTypes")] 12 | [NodeDescription("Lists the Advance Steel Hole type options")] 13 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 14 | [OutPortNames("holeType")] 15 | [OutPortTypes("int")] 16 | [OutPortDescriptions("hole type")] 17 | [IsDesignScriptCompatible] 18 | public class HoleType : AstDropDownBase 19 | { 20 | private const string outputName = "holeType"; 21 | 22 | public HoleType() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public HoleType(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List() 41 | { 42 | new DynamoDropDownItem("Select Hole Type...", -1L), 43 | new DynamoDropDownItem("Hole", 1L), 44 | new DynamoDropDownItem("Slotted Hole", 2L), 45 | new DynamoDropDownItem("Counter Sunk Hole", 3L), 46 | new DynamoDropDownItem("Blind Hole", 4L), 47 | new DynamoDropDownItem("Threaded Hole", 5L), 48 | new DynamoDropDownItem("Sunk Hole", 6L), 49 | new DynamoDropDownItem("Punch Mark", 7L) 50 | }; 51 | 52 | Items.AddRange(newItems); 53 | 54 | SelectedIndex = 0; 55 | return SelectionState.Restore; 56 | } 57 | 58 | public override IEnumerable BuildOutputAst(List inputAstNodes) 59 | { 60 | if (Items.Count == 0 || 61 | Items[SelectedIndex].Name == "Select Hole Type..." || 62 | SelectedIndex < 0) 63 | { 64 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 65 | } 66 | 67 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 68 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 69 | return new List { assign }; 70 | 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/ASSelectObjectTypes.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | using System; 8 | 9 | namespace AdvanceSteel.Nodes 10 | { 11 | [NodeName("GetSteelObjectsByType")] 12 | [NodeDescription("Select all steel objects by type")] 13 | [NodeCategory("AdvanceSteel.Nodes.Selection")] 14 | [OutPortDescriptions("list with the selected steel objects")] 15 | [OutPortNames("steelObjects")] 16 | [OutPortTypes("AdvanceSteel.Nodes.SteelDbObject")] 17 | [IsDesignScriptCompatible] 18 | public class ASSelectObjecTypes : AstDropDownBase 19 | { 20 | private const string outputName = "steelObjects"; 21 | 22 | public ASSelectObjecTypes() 23 | : base(outputName) 24 | { 25 | InPorts.Clear(); 26 | OutPorts.Clear(); 27 | RegisterAllPorts(); 28 | } 29 | 30 | [JsonConstructor] 31 | public ASSelectObjecTypes(IEnumerable inPorts, IEnumerable outPorts) 32 | : base(outputName, inPorts, outPorts) 33 | { 34 | } 35 | 36 | protected override SelectionState PopulateItemsCore(string currentSelection) 37 | { 38 | Items.Clear(); 39 | 40 | var newItems = new List(); 41 | Dictionary filterItems = Utils.GetASObjectFilters(); 42 | foreach (var item in filterItems) 43 | { 44 | newItems.Add(new DynamoDropDownItem(item.Value, (long)item.Key)); 45 | } 46 | 47 | Items.AddRange(newItems); 48 | 49 | SelectedIndex = 0; 50 | return SelectionState.Restore; 51 | } 52 | 53 | public override IEnumerable BuildOutputAst(List inputAstNodes) 54 | { 55 | if (Items.Count == 0 || 56 | Items[SelectedIndex].Name == "Select Object Type..." || 57 | SelectedIndex < 0) 58 | { 59 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 60 | } 61 | AssociativeNode node; 62 | IntNode intNode2 = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 63 | node = AstFactory.BuildFunctionCall(new Func>(Utils.GetDynObjects), new List() { intNode2 }); 64 | 65 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node); 66 | return new List { assign }; 67 | 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Util/BeamSection.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.CADAccess; 2 | using Autodesk.AdvanceSteel.Modelling; 3 | using System; 4 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 5 | 6 | namespace AdvanceSteel.Nodes.Util 7 | { 8 | /// 9 | /// This node can be used to assign Section to Advance Steel beams from Dynamo 10 | /// 11 | public class BeamSection 12 | { 13 | internal BeamSection() 14 | { 15 | } 16 | 17 | /// 18 | /// This node can set the Section for Advance Steel beams from Dynamo. 19 | /// For the Section use the following format: "HEA DIN18800-1#@§@#HEA100" 20 | /// 21 | /// Advance Steel beam 22 | /// Section 23 | /// 24 | [Obsolete] 25 | public static void SetSection(AdvanceSteel.Nodes.SteelDbObject beamElement, string sectionName) 26 | { 27 | using (var ctx = new SteelServices.DocContext()) 28 | { 29 | string handle = beamElement.Handle; 30 | 31 | FilerObject obj = Utils.GetObject(handle); 32 | 33 | if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kBeam)) 34 | { 35 | 36 | string sectionType = Utils.SplitSectionName(sectionName)[0]; 37 | string sectionSize = Utils.SplitSectionName(sectionName)[1]; 38 | 39 | Autodesk.AdvanceSteel.Modelling.Beam beam = obj as Autodesk.AdvanceSteel.Modelling.Beam; 40 | if (obj.IsKindOf(FilerObject.eObjectType.kCompoundBeam) && !Utils.CompareCompoundSectionTypes(beam.ProfSectionType, sectionType)) 41 | { 42 | throw new System.Exception("Failed to change section as compound section type is different"); 43 | } 44 | beam.ChangeProfile(sectionType, sectionSize); 45 | } 46 | else 47 | throw new System.Exception("Failed to change section"); 48 | } 49 | } 50 | 51 | /// 52 | /// Returns a concatenated string containing the SectionType, a fixed string separator "#@§@#" and the SectionSize. 53 | /// 54 | /// SectionType for a beam section 55 | /// SectionSize for a beam section 56 | /// Beam section name 57 | [Obsolete] 58 | public static string CreateSectionString(string sectionType, string sectionSize) 59 | { 60 | return sectionType + Utils.Separator + sectionSize; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/ContentBuilder/DocClasses.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Xml.Serialization; 7 | 8 | namespace ContentBuilder 9 | { 10 | [Serializable, XmlRoot("doc")] 11 | public class Doc 12 | { 13 | public Doc() 14 | { 15 | assembly = new AssemblyFile(); 16 | content = new Members(); 17 | } 18 | 19 | [XmlElement("assembly")] 20 | public AssemblyFile assembly { get; set; } 21 | 22 | [XmlElement("members")] 23 | public Members content { get; set; } 24 | 25 | public void AddContent(Doc other) 26 | { 27 | content.members.AddRange(other.content.members); 28 | } 29 | } 30 | 31 | public class AssemblyFile 32 | { 33 | [XmlElement("name")] 34 | public string name { get; set; } 35 | } 36 | 37 | public class Members 38 | { 39 | public Members() 40 | { 41 | members = new List(); 42 | } 43 | 44 | [XmlElement("member")] 45 | public List members { get; set; } 46 | } 47 | 48 | 49 | public class Member 50 | { 51 | public Member() 52 | { 53 | name = String.Empty; 54 | remarks = String.Empty; 55 | } 56 | 57 | internal string signature { get; set; } 58 | 59 | [XmlAttribute] 60 | public string name { get; set; } 61 | 62 | [XmlElement("summary")] 63 | public Summary summary { get; set; } 64 | 65 | [XmlElement("param")] 66 | public List parameters { get; set; } 67 | 68 | [XmlElement("returns")] 69 | public List returns { get; set; } 70 | 71 | [XmlElement("remarks")] 72 | public string remarks { get; set; } 73 | } 74 | 75 | 76 | public class Summary 77 | { 78 | public Summary() 79 | { 80 | description = string.Empty; 81 | } 82 | 83 | [XmlText] 84 | public string description { get; set; } 85 | } 86 | 87 | public class Param 88 | { 89 | public Param() 90 | { 91 | name = String.Empty; 92 | description = string.Empty; 93 | } 94 | 95 | [XmlAttribute] 96 | public string name { get; set; } 97 | 98 | [XmlText] 99 | public string description { get; set; } 100 | } 101 | 102 | public class Return 103 | { 104 | public Return() 105 | { 106 | name = String.Empty; 107 | description = string.Empty; 108 | } 109 | [XmlAttribute] 110 | public string name { get; set; } 111 | 112 | [XmlText] 113 | public string description { get; set; } 114 | } 115 | } -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/OneTransactionPerAllContexts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Dynamo.Applications.AdvanceSteel.Services; 7 | using Autodesk.AdvanceSteel.DocumentManagement; 8 | 9 | namespace Dynamo.Applications.AdvanceSteel 10 | { 11 | public class OneTransactionPerAllContexts : IContextManager 12 | { 13 | private static Autodesk.AdvanceSteel.CADAccess.Transaction SteelTransaction = null; 14 | private static bool DocumentLocked = false; 15 | private static bool SubscribedToRefreshCompleted = false; 16 | 17 | public void EnsureInContext(DocContext ctx) 18 | { 19 | StartTransaction(); 20 | SubscribeToRefreshCompleted(); 21 | } 22 | 23 | public void LeaveContext(DocContext ctx) 24 | { 25 | 26 | } 27 | private static void StartTransaction() 28 | { 29 | if (DocumentLocked == false) 30 | { 31 | DocumentLocked = DocumentManager.LockCurrentDocument(); 32 | } 33 | 34 | if (SteelTransaction == null && DocumentLocked == true) 35 | { 36 | SteelTransaction = Autodesk.AdvanceSteel.CADAccess.TransactionManager.StartTransaction(); 37 | } 38 | 39 | if (DocumentLocked == false || SteelTransaction == null) 40 | { 41 | throw new System.Exception("Failed to access Document"); 42 | } 43 | } 44 | private static void CloseTransaction() 45 | { 46 | if (SteelTransaction != null) 47 | { 48 | SteelTransaction.Commit(); 49 | SteelTransaction = null; 50 | } 51 | 52 | if (DocumentLocked == true) 53 | { 54 | DocumentLocked = DocumentManager.UnlockCurrentDocument(); 55 | DocumentLocked = false; 56 | } 57 | } 58 | private static void RefreshCompleted(Graph.Workspaces.HomeWorkspaceModel obj) 59 | { 60 | CloseTransaction(); 61 | UnsubscribeFromRefreshCompleted(); 62 | } 63 | private static void SubscribeToRefreshCompleted() 64 | { 65 | if (SubscribedToRefreshCompleted == false) 66 | { 67 | var dynModel = Dynamo.Applications.AdvanceSteel.Model.DynamoModel; 68 | dynModel.RefreshCompleted += RefreshCompleted; 69 | SubscribedToRefreshCompleted = true; 70 | } 71 | } 72 | private static void UnsubscribeFromRefreshCompleted() 73 | { 74 | if (SubscribedToRefreshCompleted == true) 75 | { 76 | var dynModel = Dynamo.Applications.AdvanceSteel.Model.DynamoModel; 77 | dynModel.RefreshCompleted -= RefreshCompleted; 78 | SubscribedToRefreshCompleted = false; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/ConnectionObjects/AnchorOrientationTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("AnchorOrientationTypes")] 11 | [NodeDescription("Lists the Advance Steel Anchor orientation type options")] 12 | [NodeCategory("AdvanceSteel.Nodes.ConnectionObjects")] 13 | [OutPortNames("orientationType")] 14 | [OutPortTypes("int")] 15 | [OutPortDescriptions("anchor orientation type")] 16 | [IsDesignScriptCompatible] 17 | public class AnchorOrientationType : AstDropDownBase 18 | { 19 | private const string outputName = "orientationType"; 20 | 21 | public AnchorOrientationType() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public AnchorOrientationType(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() 40 | { 41 | new DynamoDropDownItem("Select Anchor Orientation...", -1L), 42 | new DynamoDropDownItem("Normal Orientation", 0L), 43 | new DynamoDropDownItem("Diagonal Inside", 1L), 44 | new DynamoDropDownItem("Diagonal Outside", 2L), 45 | new DynamoDropDownItem("All Outside", 3L), 46 | new DynamoDropDownItem("All Inside", 4L), 47 | new DynamoDropDownItem("Inside Rotated", 5L), 48 | new DynamoDropDownItem("Outside Rotated", 6L) 49 | }; 50 | 51 | Items.AddRange(newItems); 52 | 53 | SelectedIndex = 0; 54 | return SelectionState.Restore; 55 | } 56 | 57 | public override IEnumerable BuildOutputAst(List inputAstNodes) 58 | { 59 | if (Items.Count == 0 || 60 | Items[SelectedIndex].Name == "Select Anchor Orientation..." || 61 | SelectedIndex < 0) 62 | { 63 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 64 | } 65 | 66 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 67 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 68 | return new List { assign }; 69 | 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Util/SelectionFilter.cs: -------------------------------------------------------------------------------- 1 | using AdvanceSteel.Nodes.Plates; 2 | using Autodesk.AdvanceSteel.CADAccess; 3 | using Autodesk.DesignScript.Runtime; 4 | using DynGeometry = Autodesk.DesignScript.Geometry; 5 | using SteelGeometry = Autodesk.AdvanceSteel.Geometry; 6 | using Autodesk.AdvanceSteel.DotNetRoots.DatabaseAccess; 7 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 8 | using Autodesk.AdvanceSteel.ConstructionTypes; 9 | using System.Collections.Generic; 10 | using Autodesk.AdvanceSteel.Geometry; 11 | using System.Linq; 12 | using System; 13 | 14 | 15 | namespace AdvanceSteel.Nodes.Selection 16 | { 17 | /// 18 | /// Select Advance Steel Objects 19 | /// 20 | public static class SelectionFilter 21 | { 22 | 23 | /// 24 | /// Filter a collection of steel objects by a list of object types 25 | /// 26 | /// List of steel objects 27 | /// List of accepted Steel Object Types 28 | /// gets a filtered list of steel objects that match the list of steel object types 29 | public static List FilterSelectionByType(List steelObjects, 30 | List objectTypeFilters) 31 | { 32 | List retListOfFilteredSteelObjects = new List(); 33 | ClassTypeFilter filter = createFilterObject(objectTypeFilters); 34 | 35 | using (var ctx = new SteelServices.DocContext()) 36 | { 37 | 38 | if (objectTypeFilters.Count > 0) 39 | { 40 | for (int i = 0; i < steelObjects.Count; i++) 41 | { 42 | FilerObject objX = Utils.GetObject(steelObjects[i].Handle); 43 | if (objX != null) 44 | { 45 | if (filter.Filter(objX.Type()) != FilerObject.eObjectType.kUnknown) 46 | { 47 | retListOfFilteredSteelObjects.Add(steelObjects[i]); 48 | } 49 | } 50 | else 51 | throw new System.Exception("No Object return Null during Filtering"); 52 | } 53 | } 54 | else 55 | throw new System.Exception("No Object Filter List Provided"); 56 | } 57 | 58 | return retListOfFilteredSteelObjects; 59 | } 60 | 61 | private static ClassTypeFilter createFilterObject(List objectFilters) 62 | { 63 | ClassTypeFilter filter = new ClassTypeFilter(); 64 | filter.RejectAllFirst(); 65 | for (int i = 0; i < objectFilters.Count; i++) 66 | { 67 | filter.AppendAcceptedClass((FilerObject.eObjectType)objectFilters[i]); 68 | } 69 | return filter; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/AdvanceSteelServices/LifecycleManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Dynamo.Applications.AdvanceSteel.Services 5 | { 6 | /// 7 | /// Used to manage the life of Advance Steel objects 8 | /// 9 | public class LifecycleManager 10 | { 11 | private static LifecycleManager manager; 12 | private Dictionary> wrappers; 13 | 14 | private LifecycleManager() 15 | { 16 | wrappers = new Dictionary>(); 17 | } 18 | 19 | public static LifecycleManager GetInstance() 20 | { 21 | if (manager == null) 22 | { 23 | manager = new LifecycleManager(); 24 | } 25 | 26 | return manager; 27 | } 28 | 29 | /// 30 | /// Register a new dependency between an element handle and a wrapper 31 | /// 32 | /// 33 | /// 34 | public void RegisterAsssociation(string elementHandle, object wrapper) 35 | { 36 | List existingWrappers; 37 | if (wrappers.TryGetValue(elementHandle, out existingWrappers)) 38 | { 39 | //handle already existed, check we're not over adding 40 | DynamoServices.Validity.Assert(!existingWrappers.Contains(wrapper), 41 | "Lifecycle manager alert: registering the same Element Wrapper twice"); 42 | } 43 | else 44 | { 45 | existingWrappers = new List(); 46 | wrappers.Add(elementHandle, existingWrappers); 47 | } 48 | 49 | existingWrappers.Add(wrapper); 50 | } 51 | 52 | /// 53 | /// Remove an association between an element handle and 54 | /// 55 | /// 56 | /// 57 | /// The number of remaining associations 58 | public int UnRegisterAssociation(string elementHandle, object wrapper) 59 | { 60 | List existingWrappers; 61 | if (wrappers.TryGetValue(elementHandle, out existingWrappers)) 62 | { 63 | //handle already existed, check we're not over adding 64 | if (existingWrappers.Contains(wrapper)) 65 | { 66 | existingWrappers.Remove(wrapper); 67 | if (existingWrappers.Count == 0) 68 | { 69 | wrappers.Remove(elementHandle); 70 | return 0; 71 | } 72 | else 73 | { 74 | return existingWrappers.Count; 75 | } 76 | } 77 | else 78 | { 79 | throw new InvalidOperationException( 80 | "Attempting to remove a wrapper that wasn't there registered"); 81 | } 82 | } 83 | else 84 | { 85 | //The handle didn't exist 86 | 87 | throw new InvalidOperationException( 88 | "Attempting to remove a wrapper, but there were no ids registered"); 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | using System; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyCompany("Autodesk, Inc")] 10 | [assembly: AssemblyProduct("Dynamo")] 11 | [assembly: AssemblyCopyright("Copyright © Autodesk, Inc 2024")] 12 | [assembly: AssemblyTrademark("")] 13 | 14 | // Make it easy to distinguish Debug and Release (i.e. Retail) builds; 15 | // for example, through the file properties window. 16 | #if DEBUG 17 | [assembly: AssemblyConfiguration("Debug")] 18 | [assembly: AssemblyDescription("Flavor=Debug")] // a.k.a. "Comments" 19 | #else 20 | [assembly: AssemblyConfiguration("Release")] 21 | [assembly: AssemblyDescription("Flavor=Release")] // a.k.a. "Comments" 22 | #endif 23 | 24 | // Setting ComVisible to false makes the types in this assembly not visible 25 | // to COM components. If you need to access a type in this assembly from 26 | // COM, set the ComVisible attribute to true on that type. 27 | [assembly: ComVisible(false)] 28 | 29 | // Note that the assembly version does not get incremented for every build 30 | // to avoid problems with assembly binding (or requiring a policy or 31 | // in the config file). 32 | // 33 | // The AssemblyFileVersionAttribute is incremented with every build in order 34 | // to distinguish one build from another. AssemblyFileVersion is specified 35 | // in AssemblyVersionInfo.cs so that it can be easily incremented by the 36 | // automated build process. 37 | [assembly: AssemblyVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] 38 | 39 | 40 | // By default, the "Product version" shown in the file properties window is 41 | // the same as the value specified for AssemblyFileVersionAttribute. 42 | // Set AssemblyInformationalVersionAttribute to be the same as 43 | // AssemblyVersionAttribute so that the "Product version" in the file 44 | // properties window matches the version displayed in the GAC shell extension. 45 | //[assembly: AssemblyInformationalVersion("1.0.0.0")] // a.k.a. "Product version" 46 | // Version information for an assembly consists of the following four values: 47 | // 48 | // Major Version 49 | // Minor Version 50 | // Build Number 51 | // Revision 52 | // 53 | // You can specify all the values or you can default the Build and Revision Numbers 54 | // by using the '*' as shown below: 55 | // [assembly: AssemblyVersion("1.0.*")] 56 | [assembly: AssemblyFileVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] 57 | <#+ 58 | int MajorVersion = 3; 59 | int MinorVersion = 0; 60 | int BuildNumber = 1; 61 | int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2021,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; 62 | #> -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Util/UserAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Autodesk.AdvanceSteel.CADAccess; 3 | using Autodesk.AdvanceSteel.ConstructionTypes; 4 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 5 | 6 | namespace AdvanceSteel.Nodes.Util 7 | { 8 | /// 9 | /// Custom User attributes for Advance Steel elements 10 | /// 11 | public class UserAttribute 12 | { 13 | internal UserAttribute() 14 | { 15 | } 16 | /// 17 | /// This node can set User attributes for Advance Steel elements from Dynamo 18 | /// 19 | /// Advance Steel element 20 | /// The index of the User attribute. Is a number between 1 and 10 21 | /// Attribute value 22 | /// 23 | [Obsolete("UserAttribute.SetUserAttribute is obsolete, please use SteelObject.SetUserAttribute instead.")] 24 | public static void SetUserAttribute(AdvanceSteel.Nodes.SteelDbObject steelObject, int AttIdx, string value) 25 | { 26 | if (AttIdx < 1 || AttIdx > 10) 27 | throw new System.Exception("Attribute index is not in the range from 1 to 10"); 28 | 29 | using (var ctx = new SteelServices.DocContext()) 30 | { 31 | string handle = steelObject.Handle; 32 | 33 | FilerObject obj = Utils.GetObject(handle); 34 | AtomicElement atomic = obj as AtomicElement; 35 | 36 | if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kAtomicElem)) 37 | { 38 | //[1, 10] ->[0 ,9] 39 | AttIdx = AttIdx - 1; 40 | 41 | atomic.SetUserAttribute(AttIdx, value); 42 | } 43 | else 44 | throw new System.Exception("Failed to set attribute"); 45 | } 46 | } 47 | 48 | /// 49 | /// This node can get User attributes for Advance Steel elements from Dynamo 50 | /// 51 | /// Advance Steel element 52 | /// The index of the User attribute. Is a number between 1 and 10 53 | /// 54 | [Obsolete("UserAttribute.GetUserAttribute is obsolete, please use SteelObject.GetUserAttribute instead.")] 55 | public static string GetUserAttribute(AdvanceSteel.Nodes.SteelDbObject steelObject, int AttIdx) 56 | { 57 | string ret = string.Empty; 58 | 59 | if (AttIdx < 1 || AttIdx > 10) 60 | throw new System.Exception("Attribute index is not in the range from 1 to 10"); 61 | 62 | using (var ctx = new SteelServices.DocContext()) 63 | { 64 | string handle = steelObject.Handle; 65 | 66 | FilerObject obj = Utils.GetObject(handle); 67 | AtomicElement atomic = obj as AtomicElement; 68 | 69 | if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kAtomicElem)) 70 | { 71 | //[1, 10] ->[0 ,9] 72 | AttIdx = AttIdx - 1; 73 | 74 | ret = atomic.GetUserAttribute(AttIdx); 75 | } 76 | else 77 | throw new System.Exception("Failed to get attribute"); 78 | } 79 | 80 | return ret; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /src/DynamoAdvanceSteelInstall/DynamoAdvanceSteelInstall.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Debug 8 | x86 9 | 3.8 10 | {c7495640-0d0c-46ab-a5f3-d5be78f89a0d} 11 | 2.0 12 | DynamoForAdvanceSteel2026 13 | Package 14 | $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets 15 | $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets 16 | 17 | 18 | ..\..\setup\installers\ 19 | obj\$(Configuration)\ 20 | Debug;basePath=$(DYNAMO_BASE_PATH);samples=$(DYNAMO_STEEL_SAMPLES_PATH);solPath=$(SOLUTION_BASE_PATH) 21 | True 22 | False 23 | True 24 | True 25 | 26 | 27 | ..\..\setup\installers\ 28 | Release 29 | obj\$(Configuration)\ 30 | basePath=$(DYNAMO_BASE_PATH);samples=$(DYNAMO_STEEL_SAMPLES_PATH);solPath=$(SOLUTION_BASE_PATH) 31 | True 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | $(WixExtDir)\WixUIExtension.dll 42 | WixUIExtension 43 | 44 | 45 | $(WixExtDir)\WixUtilExtension.dll 46 | WixUtilExtension 47 | 48 | 49 | 50 | 51 | 52 | 53 | 61 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/SteelAuthProvider.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AutoCAD.Internal; 2 | using Greg; 3 | using Greg.AuthProviders; 4 | using RestSharp; 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | using System.Threading; 9 | using System.Windows.Threading; 10 | 11 | namespace Dynamo.Applications.AdvanceSteel 12 | { 13 | internal class SteelAuthProvider : IOAuth2AuthProvider 14 | { 15 | private readonly SynchronizationContext SyncContext; 16 | 17 | public event Func RequestLogin; 18 | public event Action LoginStateChanged; 19 | 20 | public SteelAuthProvider() 21 | { 22 | SyncContext = new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher); 23 | } 24 | 25 | public LoginState LoginState 26 | { 27 | get 28 | { 29 | bool result = false; 30 | SyncContext.Send((_) => result = WSUtils.IsLoggedIn(), null); 31 | return result ? LoginState.LoggedIn : LoginState.LoggedOut; 32 | } 33 | } 34 | 35 | public string Username 36 | { 37 | get 38 | { 39 | var result = string.Empty; 40 | SyncContext.Send((_) => result = WSUtils.GetLoginUserName(), null); 41 | return result; 42 | } 43 | } 44 | 45 | public bool Login() 46 | { 47 | bool result = false; 48 | 49 | SyncContext.Send((_) => result = WSUtils.Login(), null); 50 | LoginStateChanged?.Invoke(result ? LoginState.LoggedIn : LoginState.LoggedOut); 51 | 52 | return result; 53 | } 54 | 55 | public void Logout() 56 | { 57 | SyncContext.Send((_) => PInvoke.AcConnectWebServicesLogout(), null); 58 | LoginStateChanged?.Invoke(LoginState.LoggedOut); 59 | } 60 | 61 | public void SignRequest(ref RestRequest m, RestClient client) 62 | { 63 | if (LoginState == LoginState.LoggedOut && !Login()) 64 | { 65 | throw new Exception("You must be logged into AutoCAD to use the package manager."); 66 | } 67 | 68 | m.AddHeader("Authorization", $"Bearer {WSUtils.GetO2tk("data:create data:write")}"); 69 | } 70 | 71 | private static readonly string[] UriRfc3986CharsToEscape = new[] { "!", "*", "'", "(", ")" }; 72 | private static readonly string[] UriRfc3968EscapedHex = new[] { "%21", "%2A", "%27", "%28", "%29" }; 73 | 74 | private static string UrlEncodeRelaxed(string value) 75 | { 76 | // Start with RFC 2396 escaping by calling the .NET method to do the work. 77 | // This MAY sometimes exhibit RFC 3986 behavior (according to the documentation). 78 | // If it does, the escaping we do that follows it will be a no-op since the 79 | // characters we search for to replace can't possibly exist in the string. 80 | var escaped = new StringBuilder(Uri.EscapeDataString(value)); 81 | 82 | // Upgrade the escaping to RFC 3986, if necessary. 83 | for (var i = 0; i < UriRfc3986CharsToEscape.Length; i++) 84 | { 85 | var t = UriRfc3986CharsToEscape[i]; 86 | escaped.Replace(t, UriRfc3968EscapedHex[i]); 87 | } 88 | 89 | // Return the fully-RFC3986-escaped string. 90 | return escaped.ToString(); 91 | } 92 | } 93 | internal static class PInvoke 94 | { 95 | [DllImport("AcConnectWebServices.arx", EntryPoint = "AcConnectWebServicesLogout")] 96 | public static extern bool AcConnectWebServicesLogout(); 97 | } 98 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/SteelElements/BeamRefAxisTypeDropDown.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CoreNodeModels; 3 | using Dynamo.Graph.Nodes; 4 | using Dynamo.Utilities; 5 | using ProtoCore.AST.AssociativeAST; 6 | using Newtonsoft.Json; 7 | 8 | namespace AdvanceSteel.Nodes 9 | { 10 | [NodeName("BeamReferenceAxis")] 11 | [NodeDescription("Lists the Advance Steel Beam Reference Axis options - e.g. Top Left, Middle Middle, Countour Center")] 12 | [NodeCategory("AdvanceSteel.Nodes.Beams")] 13 | [OutPortNames("referenceAxis")] 14 | [OutPortTypes("int")] 15 | [OutPortDescriptions("beam reference axis")] 16 | [IsDesignScriptCompatible] 17 | public class BeamRefAxisType : AstDropDownBase 18 | { 19 | private const string outputName = "referenceAxis"; 20 | 21 | public BeamRefAxisType() 22 | : base(outputName) 23 | { 24 | InPorts.Clear(); 25 | OutPorts.Clear(); 26 | RegisterAllPorts(); 27 | } 28 | 29 | [JsonConstructor] 30 | public BeamRefAxisType(IEnumerable inPorts, IEnumerable outPorts) 31 | : base(outputName, inPorts, outPorts) 32 | { 33 | } 34 | 35 | protected override SelectionState PopulateItemsCore(string currentSelection) 36 | { 37 | Items.Clear(); 38 | 39 | var newItems = new List() 40 | { 41 | new DynamoDropDownItem("Select Beam Ref Axis...", -1L), 42 | new DynamoDropDownItem("Upper Left", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kUpperLeft), 43 | new DynamoDropDownItem("Upper Middle", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kUpperSys), 44 | new DynamoDropDownItem("Upper Right", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kUpperRight), 45 | new DynamoDropDownItem("Middle Left", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kMidLeft), 46 | new DynamoDropDownItem("Middle Middle", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kSysSys), 47 | new DynamoDropDownItem("Middle Right", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kMidRight), 48 | new DynamoDropDownItem("Lower Left", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kLowerLeft), 49 | new DynamoDropDownItem("Lower Middle", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kLowerSys), 50 | new DynamoDropDownItem("Lower Right", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kLowerRight), 51 | new DynamoDropDownItem("Contour Center", (long)Autodesk.AdvanceSteel.Modelling.Beam.eRefAxis.kContourCenter) 52 | }; 53 | 54 | Items.AddRange(newItems); 55 | 56 | SelectedIndex = 0; 57 | return SelectionState.Restore; 58 | } 59 | 60 | public override IEnumerable BuildOutputAst(List inputAstNodes) 61 | { 62 | if (Items.Count == 0 || 63 | Items[SelectedIndex].Name == "Select Beam Ref Axis..." || 64 | SelectedIndex < 0) 65 | { 66 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }; 67 | } 68 | 69 | var intNode = AstFactory.BuildIntNode((long)Items[SelectedIndex].Item); 70 | var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), intNode); 71 | return new List { assign }; 72 | 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/PathResolver.cs: -------------------------------------------------------------------------------- 1 | using Dynamo.Configuration; 2 | using Dynamo.Interfaces; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Reflection; 8 | 9 | namespace Dynamo.Applications.AdvanceSteel 10 | { 11 | internal class PathResolver : IPathResolver 12 | { 13 | private readonly List preloadLibraryPaths; 14 | private readonly List additionalNodeDirectories; 15 | private readonly List additionalResolutionPaths; 16 | private readonly string userDataRootFolder; 17 | private readonly string commonDataRootFolder; 18 | 19 | internal PathResolver(string userDataFolder, string commonDataFolder) 20 | { 21 | userDataRootFolder = userDataFolder; 22 | commonDataRootFolder = commonDataFolder; 23 | 24 | string steelNodesDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 25 | 26 | 27 | additionalNodeDirectories = new List { steelNodesDirectory }; 28 | additionalResolutionPaths = new List { steelNodesDirectory }; 29 | 30 | var steelNodesDll = Path.Combine(steelNodesDirectory, "AdvanceSteelNodes.dll"); 31 | 32 | preloadLibraryPaths = new List 33 | { 34 | "VMDataBridge.dll", 35 | "ProtoGeometry.dll", 36 | "DesignScriptBuiltin.dll", 37 | "DSCoreNodes.dll", 38 | "DSOffice.dll", 39 | //"DSIronPython.dll", > version 2.6 - it isn't needed to use this because DSIronPython is loaded by extension(without IronPython installed) 40 | "DSCPython.dll", // > version 2.7 41 | "FunctionObject.ds", 42 | "BuiltIn.ds", 43 | "DynamoConversions.dll", 44 | "DynamoUnits.dll", 45 | "Tessellation.dll", 46 | "Analysis.dll", 47 | "GeometryColor.dll", 48 | steelNodesDll 49 | }; 50 | } 51 | 52 | public IEnumerable AdditionalNodeDirectories 53 | { 54 | get { return additionalNodeDirectories; } 55 | } 56 | 57 | public IEnumerable AdditionalResolutionPaths 58 | { 59 | get { return additionalResolutionPaths; } 60 | } 61 | 62 | public IEnumerable PreloadedLibraryPaths 63 | { 64 | get { return preloadLibraryPaths; } 65 | } 66 | 67 | public string UserDataRootFolder 68 | { 69 | get { return userDataRootFolder; } 70 | } 71 | 72 | public string CommonDataRootFolder 73 | { 74 | get { return commonDataRootFolder; } 75 | } 76 | 77 | public IEnumerable GetDynamoUserDataLocations() 78 | { 79 | var appDatafolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); 80 | 81 | var paths = new List(); 82 | //Pre 1.0 Dynamo Studio user data was stored at %appdata%\Dynamo\ 83 | var dynamoFolder = Path.Combine(appDatafolder, "Dynamo"); 84 | if (Directory.Exists(dynamoFolder)) 85 | { 86 | paths.AddRange(Directory.EnumerateDirectories(dynamoFolder)); 87 | } 88 | 89 | //From 1.0 onwards Dynamo Studio user data is stored at %appdata%\Dynamo\Dynamo Advance Steel 90 | var advanceSteelFolder = Path.Combine(dynamoFolder, "Dynamo Advance Steel"); 91 | if (Directory.Exists(advanceSteelFolder)) 92 | { 93 | paths.AddRange(Directory.EnumerateDirectories(advanceSteelFolder)); 94 | } 95 | 96 | return paths; 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/ConnectionObjects/WeldLine.cs: -------------------------------------------------------------------------------- 1 | using AdvanceSteel.Nodes.Plates; 2 | using Autodesk.AdvanceSteel.CADAccess; 3 | using Autodesk.DesignScript.Runtime; 4 | using DynGeometry = Autodesk.DesignScript.Geometry; 5 | using SteelGeometry = Autodesk.AdvanceSteel.Geometry; 6 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 7 | using Autodesk.AdvanceSteel.ConstructionTypes; 8 | using System.Collections.Generic; 9 | using Autodesk.AdvanceSteel.Geometry; 10 | using System.Linq; 11 | using System; 12 | 13 | namespace AdvanceSteel.Nodes.ConnectionObjects.Welds 14 | { 15 | /// 16 | /// Advance Steel Weld Line, including Onsite v InShop Connection Type 17 | /// 18 | [DynamoServices.RegisterForTrace] 19 | public class WeldLine : GraphicObject 20 | { 21 | internal WeldLine() 22 | { 23 | } 24 | 25 | internal WeldLine(SteelGeometry.Point3d[] astPoints, IEnumerable handlesToConnect, int connectionType, bool isClosed = false) 26 | { 27 | lock (access_obj) 28 | { 29 | using (var ctx = new SteelServices.DocContext()) 30 | { 31 | 32 | string handle = SteelServices.ElementBinder.GetHandleFromTrace(); 33 | 34 | FilerObject existingObject = Utils.GetObject(handle); 35 | existingObject?.DelFromDb(); 36 | 37 | var weld = new Autodesk.AdvanceSteel.Modelling.WeldLine(astPoints, Vector3d.kXAxis, Vector3d.kYAxis); 38 | weld.IsClosed = isClosed; 39 | weld.WriteToDb(); 40 | 41 | weld.Connect(Utils.GetSteelObjectsToConnect(handlesToConnect), (AtomicElement.eAssemblyLocation)connectionType); 42 | 43 | Handle = weld.Handle; 44 | SteelServices.ElementBinder.CleanupAndSetElementForTrace(weld); 45 | } 46 | } 47 | } 48 | 49 | /// 50 | /// Create an Advance Steel Weld Line By PolyCurve 51 | /// 52 | /// Input Weld PolyCurve 53 | /// Input Weld Connected Objects 54 | /// Input Weld Type - 0-OnSite or 2-InShop 55 | /// weldLine 56 | public static WeldLine ByPolyCurve(DynGeometry.PolyCurve polyCurve, 57 | IEnumerable objectsToConnect, 58 | [DefaultArgument("2;")] int connectionType) 59 | { 60 | List handlesList = Utils.GetSteelDbObjectsToConnect(objectsToConnect); 61 | 62 | var temp = polyCurve.Curves(); 63 | SteelGeometry.Point3d[] astArr = new SteelGeometry.Point3d[temp.Length + 1]; 64 | for (int i = 0; i < temp.Length; i++) 65 | { 66 | Point3d startPoint = Utils.ToAstPoint(temp[i].StartPoint, true); 67 | astArr[i] = startPoint; 68 | } 69 | 70 | Point3d endPoint = Utils.ToAstPoint(temp[temp.Length - 1].EndPoint, true); 71 | astArr[temp.Length] = endPoint; 72 | 73 | return new WeldLine(astArr, handlesList, connectionType, polyCurve.IsClosed); 74 | } 75 | 76 | [IsVisibleInDynamoLibrary(false)] 77 | public override Autodesk.DesignScript.Geometry.Curve GetDynCurve() 78 | { 79 | lock (access_obj) 80 | { 81 | using (var ctx = new SteelServices.DocContext()) 82 | { 83 | var weld = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.WeldLine; 84 | 85 | if (weld == null) 86 | throw new Exception("Null weld line"); 87 | 88 | weld.GetWeldPoints(out Point3d[] arrPoints, Autodesk.AdvanceSteel.Modelling.WeldPattern.eSeamPosition.kUpper); 89 | DynGeometry.Point[] dynPoints = Utils.ToDynPoints(arrPoints, true); 90 | return Autodesk.DesignScript.Geometry.PolyCurve.ByPoints(new HashSet(dynPoints), weld.IsClosed); 91 | } 92 | } 93 | } 94 | } 95 | } 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/ConnectionObjects/WeldPoint.cs: -------------------------------------------------------------------------------- 1 | using AdvanceSteel.Nodes.Plates; 2 | using Autodesk.AdvanceSteel.CADAccess; 3 | using Autodesk.DesignScript.Runtime; 4 | using DynGeometry = Autodesk.DesignScript.Geometry; 5 | using SteelGeometry = Autodesk.AdvanceSteel.Geometry; 6 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 7 | using Autodesk.AdvanceSteel.ConstructionTypes; 8 | using System.Collections.Generic; 9 | using Autodesk.AdvanceSteel.Geometry; 10 | using System.Linq; 11 | using System; 12 | 13 | namespace AdvanceSteel.Nodes.ConnectionObjects.Welds 14 | { 15 | /// 16 | /// Advance Steel Weld Point, including Onsite v InShop Connection Type 17 | /// 18 | [DynamoServices.RegisterForTrace] 19 | public class WeldPoint : GraphicObject 20 | { 21 | internal WeldPoint() 22 | { 23 | } 24 | 25 | internal WeldPoint(SteelGeometry.Point3d astPoint, IEnumerable handlesToConnect, int connectionType) 26 | { 27 | lock (access_obj) 28 | { 29 | using (var ctx = new SteelServices.DocContext()) 30 | { 31 | Autodesk.AdvanceSteel.Modelling.WeldPoint weld = null; 32 | string handle = SteelServices.ElementBinder.GetHandleFromTrace(); 33 | 34 | if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) 35 | { 36 | weld = new Autodesk.AdvanceSteel.Modelling.WeldPoint(astPoint, Vector3d.kXAxis, Vector3d.kYAxis); 37 | weld.WriteToDb(); 38 | } 39 | else 40 | { 41 | weld = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.WeldPoint; 42 | 43 | if (weld != null && weld.IsKindOf(FilerObject.eObjectType.kWeldPattern)) 44 | { 45 | Matrix3d coordinateSystem = new Matrix3d(); 46 | coordinateSystem.SetCoordSystem(astPoint, Vector3d.kXAxis, Vector3d.kYAxis, Vector3d.kZAxis); 47 | weld.SetCS(coordinateSystem); 48 | } 49 | else 50 | throw new System.Exception("Not a weld point"); 51 | } 52 | 53 | FilerObject[] filerObjects = Utils.GetFilerObjects(handlesToConnect); 54 | weld.Connect(filerObjects, (AtomicElement.eAssemblyLocation)connectionType); 55 | 56 | Handle = weld.Handle; 57 | SteelServices.ElementBinder.CleanupAndSetElementForTrace(weld); 58 | } 59 | } 60 | } 61 | /// 62 | /// Create an Advance Steel Weld Pattern By Point 63 | /// 64 | /// Input Weld Point Location 65 | /// Input Connected Objects 66 | /// Input Weld Type - 0-OnSite or 2-InShop 67 | /// weldPoint 68 | public static WeldPoint ByPoint(DynGeometry.Point point, 69 | IEnumerable objectsToConnect, 70 | [DefaultArgument("2;")] int connectionType) 71 | { 72 | 73 | List handlesList = new List(); 74 | handlesList = Utils.GetSteelDbObjectsToConnect(objectsToConnect); 75 | 76 | var astPoint = Utils.ToAstPoint(point, true); 77 | return new WeldPoint(astPoint, handlesList, connectionType); 78 | } 79 | 80 | [IsVisibleInDynamoLibrary(false)] 81 | public override Autodesk.DesignScript.Geometry.Curve GetDynCurve() 82 | { 83 | lock (access_obj) 84 | { 85 | using (var ctx = new SteelServices.DocContext()) 86 | { 87 | var weld = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.WeldPoint; 88 | 89 | if (weld == null) 90 | { 91 | throw new Exception("Null weld point"); 92 | } 93 | 94 | using (var dynPoint = Utils.ToDynPoint(weld.CenterPoint, true)) 95 | { 96 | return Autodesk.DesignScript.Geometry.Circle.ByCenterPointRadius(dynPoint, 0.01); 97 | } 98 | } 99 | } 100 | } 101 | } 102 | } 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/SteelSelection.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.DesignScript.Runtime; 2 | using CoreNodeModels; 3 | using Dynamo.Applications.AdvanceSteel.Services; 4 | using Dynamo.Graph.Nodes; 5 | using Dynamo.Graph.Workspaces; 6 | using Dynamo.Models; 7 | using Newtonsoft.Json; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.ComponentModel; 11 | 12 | namespace AdvanceSteel.Nodes 13 | { 14 | public abstract class SteelSelection : SelectionBase 15 | { 16 | private DynamoModel dynamoModel; 17 | 18 | #region public properties 19 | 20 | public DynamoModel DynamoModel 21 | { 22 | get 23 | { 24 | return dynamoModel; 25 | } 26 | set 27 | { 28 | if (dynamoModel != null) 29 | { 30 | var hwm = dynamoModel.CurrentWorkspace as HomeWorkspaceModel; 31 | if (hwm != null) 32 | { 33 | hwm.RunSettings.PropertyChanged -= model_PropertyChanged; 34 | } 35 | } 36 | 37 | dynamoModel = value; 38 | 39 | if (dynamoModel != null) 40 | { 41 | var hwm = dynamoModel.CurrentWorkspace as HomeWorkspaceModel; 42 | if (hwm != null) 43 | { 44 | hwm.RunSettings.PropertyChanged += model_PropertyChanged; 45 | } 46 | } 47 | } 48 | } 49 | 50 | public override bool CanSelect 51 | { 52 | get 53 | { 54 | if (dynamoModel != null) 55 | { 56 | // Different document, disable selection button. 57 | //if (!dynamoModel.IsInMatchingDocumentContext) 58 | // return false; 59 | 60 | var hwm = dynamoModel.CurrentWorkspace as HomeWorkspaceModel; 61 | if (hwm != null) 62 | { 63 | return base.CanSelect && hwm.RunSettings.RunEnabled; 64 | } 65 | else 66 | { 67 | return false; 68 | } 69 | } 70 | else 71 | { 72 | return base.CanSelect; 73 | } 74 | } 75 | set { base.CanSelect = value; } 76 | } 77 | 78 | 79 | /// 80 | /// Handler for the DynamoModel's PropertyChanged event. 81 | /// 82 | /// 83 | /// 84 | private void model_PropertyChanged(object sender, PropertyChangedEventArgs e) 85 | { 86 | // Use the RunEnabled flag on the dynamo model 87 | // to set the CanSelect flag, enabling or disabling 88 | // any bound UI when the dynamo model is not 89 | // in a runnable state. 90 | if (e.PropertyName == "RunEnabled") 91 | { 92 | RaisePropertyChanged("CanSelect"); 93 | } 94 | } 95 | 96 | 97 | #endregion 98 | 99 | protected SteelSelection(SelectionType selectionType, 100 | SelectionObjectType selectionObjectType, string message, string prefix) 101 | : base(selectionType, selectionObjectType, message, prefix) 102 | { 103 | AppResolver.Resolve().DocumentOpened += Controller_DocumentChanged; 104 | } 105 | 106 | [JsonConstructor] 107 | public SteelSelection(SelectionType selectionType, 108 | SelectionObjectType selectionObjectType, string message, string prefix, 109 | IEnumerable selectionIdentifier, IEnumerable inPorts, IEnumerable outPorts) 110 | : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) 111 | { 112 | AppResolver.Resolve().DocumentOpened += Controller_DocumentChanged; 113 | } 114 | 115 | private void Controller_DocumentChanged(object sender, EventArgs e) 116 | { 117 | ClearSelections(); 118 | } 119 | 120 | #region public methods 121 | 122 | public override void Dispose() 123 | { 124 | base.Dispose(); 125 | 126 | AppResolver.Resolve().DocumentOpened -= Controller_DocumentChanged; 127 | 128 | if (dynamoModel != null) 129 | { 130 | var hwm = dynamoModel.CurrentWorkspace as HomeWorkspaceModel; 131 | if (hwm != null) 132 | { 133 | hwm.RunSettings.PropertyChanged -= model_PropertyChanged; 134 | } 135 | } 136 | } 137 | 138 | public override void UpdateSelection(IEnumerable rawSelection) 139 | { 140 | base.UpdateSelection(rawSelection); 141 | } 142 | 143 | #endregion 144 | 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29905.134 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamoAdvanceSteel", "DynamoAdvanceSteel\DynamoAdvanceSteel.csproj", "{DD6E77D3-94AC-4D22-95EA-67708F4A0A4A}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} 9 | {CC7479AA-E913-4C40-994F-78E044AF7A8A} = {CC7479AA-E913-4C40-994F-78E044AF7A8A} 10 | EndProjectSection 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvanceSteelNodes", "AdvanceSteelNodes\AdvanceSteelNodes.csproj", "{785BB90B-886C-411D-8D34-8F85E9479A9C}" 13 | ProjectSection(ProjectDependencies) = postProject 14 | {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} 15 | EndProjectSection 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvanceSteelServices", "AdvanceSteelServices\AdvanceSteelServices.csproj", "{00ED013F-0B34-4A79-9760-A21FD14D4BD5}" 18 | ProjectSection(ProjectDependencies) = postProject 19 | {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} 20 | EndProjectSection 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyInfoGenerator", "AssemblySharedInfoGenerator\AssemblyInfoGenerator.csproj", "{133FC760-5699-46D9-BEA6-E816B5F01016}" 23 | EndProject 24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BA0FF99D-A1CF-4F06-A0D1-8CBA0520893C}" 25 | ProjectSection(SolutionItems) = preProject 26 | .editorconfig = .editorconfig 27 | transform_all.bat = transform_all.bat 28 | EndProjectSection 29 | EndProject 30 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvanceSteelNodesUI", "AdvanceSteelNodesUI\AdvanceSteelNodesUI.csproj", "{CC7479AA-E913-4C40-994F-78E044AF7A8A}" 31 | ProjectSection(ProjectDependencies) = postProject 32 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6} = {00ED013F-0B34-4A79-9760-A21FD14D4BD6} 33 | EndProjectSection 34 | EndProject 35 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContentBuilder", "ContentBuilder\ContentBuilder.csproj", "{00ED013F-0B34-4A79-9760-A21FD14D4BD6}" 36 | ProjectSection(ProjectDependencies) = postProject 37 | {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} 38 | EndProjectSection 39 | EndProject 40 | Global 41 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 42 | Debug|Any CPU = Debug|Any CPU 43 | Release|Any CPU = Release|Any CPU 44 | EndGlobalSection 45 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 46 | {DD6E77D3-94AC-4D22-95EA-67708F4A0A4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {DD6E77D3-94AC-4D22-95EA-67708F4A0A4A}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {DD6E77D3-94AC-4D22-95EA-67708F4A0A4A}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {DD6E77D3-94AC-4D22-95EA-67708F4A0A4A}.Release|Any CPU.Build.0 = Release|Any CPU 50 | {785BB90B-886C-411D-8D34-8F85E9479A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {785BB90B-886C-411D-8D34-8F85E9479A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {785BB90B-886C-411D-8D34-8F85E9479A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {785BB90B-886C-411D-8D34-8F85E9479A9C}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {00ED013F-0B34-4A79-9760-A21FD14D4BD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {00ED013F-0B34-4A79-9760-A21FD14D4BD5}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {00ED013F-0B34-4A79-9760-A21FD14D4BD5}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {00ED013F-0B34-4A79-9760-A21FD14D4BD5}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 59 | {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.Build.0 = Debug|Any CPU 60 | {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.ActiveCfg = Release|Any CPU 61 | {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.Build.0 = Release|Any CPU 62 | {CC7479AA-E913-4C40-994F-78E044AF7A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {CC7479AA-E913-4C40-994F-78E044AF7A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {CC7479AA-E913-4C40-994F-78E044AF7A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU 65 | {CC7479AA-E913-4C40-994F-78E044AF7A8A}.Release|Any CPU.Build.0 = Release|Any CPU 66 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 67 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6}.Debug|Any CPU.Build.0 = Debug|Any CPU 68 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6}.Release|Any CPU.ActiveCfg = Release|Any CPU 69 | {00ED013F-0B34-4A79-9760-A21FD14D4BD6}.Release|Any CPU.Build.0 = Release|Any CPU 70 | EndGlobalSection 71 | GlobalSection(SolutionProperties) = preSolution 72 | HideSolutionNode = FALSE 73 | EndGlobalSection 74 | GlobalSection(ExtensibilityGlobals) = postSolution 75 | SolutionGuid = {8C1DAECF-BC90-403B-B7F5-0B3208687189} 76 | EndGlobalSection 77 | EndGlobal 78 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/AdvanceSteelNodesUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {CC7479AA-E913-4C40-994F-78E044AF7A8A} 7 | AdvanceSteel.Nodes 8 | false 9 | $(OutputPath)\AdvanceSteelNodesUI.xml 10 | MSB3277;CS0067;CS1591 11 | 12 | 13 | "$(OutputPath)\ContentBuilder.exe" "$(OutputPath)" "$(OutputPath)..\..\..\..\..\nodes.md" 14 | 15 | 16 | 17 | $(ADVANCESTEELAPI)\Extensions\ASControls.dll 18 | False 19 | 20 | 21 | $(ADVANCESTEELAPI)\ASObjectsMgd.dll 22 | False 23 | 24 | 25 | $(ADVANCESTEELAPI)\ASGeometryMgd.dll 26 | False 27 | 28 | 29 | $(ADVANCESTEELAPI)\ASSteelControls.dll 30 | False 31 | 32 | 33 | $(DYNAMOAPI)\nodes\CoreNodeModels.dll 34 | False 35 | 36 | 37 | $(DYNAMOAPI)\nodes\CoreNodeModelsWpf.dll 38 | False 39 | 40 | 41 | $(DYNAMOAPI)\DesignScriptBuiltin.dll 42 | False 43 | 44 | 45 | $(DYNAMOAPI)\DSCoreNodes.dll 46 | False 47 | 48 | 49 | $(DYNAMOAPI)\DSCPython.dll 50 | False 51 | 52 | 53 | $(DYNAMOAPI)\DynamoApplications.dll 54 | False 55 | 56 | 57 | $(DYNAMOAPI)\DynamoCore.dll 58 | False 59 | 60 | 61 | $(DYNAMOAPI)\DynamoCoreWpf.dll 62 | False 63 | 64 | 65 | $(DYNAMOAPI)\DynamoInstallDetective.dll 66 | False 67 | 68 | 69 | $(DYNAMOAPI)\DynamoServices.dll 70 | False 71 | 72 | 73 | $(DYNAMOAPI)\DynamoShapeManager.dll 74 | False 75 | 76 | 77 | $(DYNAMOAPI)\DynamoUnits.dll 78 | False 79 | 80 | 81 | $(DYNAMOAPI)\DynamoUtilities.dll 82 | False 83 | 84 | 85 | $(DYNAMOAPI)\Newtonsoft.Json.dll 86 | False 87 | False 88 | 89 | 90 | $(DYNAMOAPI)\nunit.framework.dll 91 | False 92 | 93 | 94 | $(DYNAMOAPI)\ProtoCore.dll 95 | False 96 | 97 | 98 | $(DYNAMOAPI)\ProtoGeometry.dll 99 | False 100 | 101 | 102 | $(DYNAMOAPI)\VMDataBridge.dll 103 | False 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodesUI/Miscellaneous/ASobjectSelection.cs: -------------------------------------------------------------------------------- 1 | using CoreNodeModels; 2 | using Dynamo.Graph.Nodes; 3 | using Newtonsoft.Json; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using Dynamo.Logging; 8 | using ProtoCore.AST.AssociativeAST; 9 | using CoreNodeModelsWpf.Nodes; 10 | using Dynamo.Wpf; 11 | using Dynamo.Controls; 12 | using Dynamo.Applications.AdvanceSteel.Services; 13 | using Autodesk.DesignScript.Runtime; 14 | 15 | namespace AdvanceSteel.Nodes 16 | { 17 | /// 18 | /// Used to extract steel beams 19 | /// 20 | [IsDesignScriptCompatible] 21 | [IsVisibleInDynamoLibrary(true)] 22 | [NodeCategory("AdvanceSteel.Nodes.Selection")] 23 | [NodeName("SelectAdvanceSteelObjects")] 24 | [NodeDescription("Asks the user to do a selection, only the Advance Steel objects are added to the selection set")] 25 | [OutPortNames("steelObjects")] 26 | [OutPortTypes("AdvanceSteel.Nodes.SteelDbObject")] 27 | public class ASObjectSelection : SteelSelection 28 | { 29 | /// 30 | /// Provides a way to manually select model elements. 31 | /// 32 | /// 33 | /// (Selection button for model elements) 34 | /// 35 | /// The resulting list of elements. 36 | public ASObjectSelection() 37 | : base( 38 | SelectionType.Many, 39 | SelectionObjectType.Element, 40 | "Structure Data", 41 | "Structure Data") 42 | { } 43 | 44 | /// 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | [JsonConstructor] 51 | public ASObjectSelection(IEnumerable selectionIdentifier, IEnumerable inPorts, IEnumerable outPorts) 52 | : base( 53 | SelectionType.Many, 54 | SelectionObjectType.Element, 55 | "Structure Data", 56 | "Structure Data", 57 | selectionIdentifier, 58 | inPorts, 59 | outPorts) 60 | { } 61 | 62 | /// 63 | /// 64 | /// 65 | public override IModelSelectionHelper SelectionHelper 66 | { 67 | get { return new SteelSelectionHelper(); } 68 | } 69 | 70 | /// 71 | /// 72 | /// 73 | /// 74 | /// 75 | public override IEnumerable BuildOutputAst(List inputAstNodes) 76 | { 77 | AssociativeNode node; 78 | 79 | if (SelectionResults == null || !SelectionResults.Any()) 80 | { 81 | node = AstFactory.BuildNullNode(); 82 | } 83 | else 84 | { 85 | IEnumerable strInputs = SelectionResults.Select(res => AstFactory.BuildStringNode(res) as AssociativeNode); 86 | ExprListNode inputNode1 = AstFactory.BuildExprList(strInputs.ToList()); 87 | node = AstFactory.BuildFunctionCall(new Func, IEnumerable>(Utils.GetDynObjects), new List() { inputNode1 }); 88 | } 89 | 90 | return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) }; 91 | } 92 | 93 | /// 94 | /// 95 | /// 96 | /// 97 | /// 98 | protected override string GetModelObjectFromIdentifer(string id) 99 | { 100 | return id; 101 | } 102 | 103 | /// 104 | /// 105 | /// 106 | /// 107 | /// 108 | protected override string GetIdentifierFromModelObject(string modelObject) 109 | { 110 | return modelObject; 111 | } 112 | 113 | /// 114 | /// 115 | /// 116 | /// 117 | /// 118 | protected override IEnumerable ExtractSelectionResults(string selection) 119 | { 120 | return new string[] { selection }; 121 | } 122 | } 123 | 124 | public class ASObjectSelectionNodeViewCustomization : 125 | SelectionBaseNodeViewCustomization, 126 | INodeViewCustomization 127 | { 128 | /// 129 | /// 130 | /// 131 | /// 132 | /// 133 | public void CustomizeView(ASObjectSelection model, NodeView nodeView) 134 | { 135 | base.CustomizeView(model, nodeView); 136 | model.DynamoModel = nodeView.ViewModel.DynamoViewModel.Model; 137 | } 138 | } 139 | internal class SteelSelectionHelper : CoreNodeModels.IModelSelectionHelper 140 | { 141 | public event Action MessageLogged; 142 | 143 | public IEnumerable RequestSelectionOfType(string selectionMessage, SelectionType selectionType, SelectionObjectType objectType) 144 | { 145 | IAppInteraction appInteraction = AppResolver.Resolve(); 146 | var descs = appInteraction.PickElements(); 147 | return descs; 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/ConnectionObjects/ConnectionObject.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AdvanceSteel.CADAccess; 2 | using Autodesk.AdvanceSteel.ConstructionTypes; 3 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 4 | 5 | namespace AdvanceSteel.Nodes.ConnectionObjectsFunctions 6 | { 7 | public class ConnectionObject 8 | { 9 | internal ConnectionObject() { } 10 | 11 | /// 12 | /// Set assembly location 13 | /// 14 | /// Input connection object 15 | /// Input assembly location 16 | /// The updated screwBolts object 17 | public static SteelDbObject SetBoltAssemblyLocation(SteelDbObject screwBolts, int connectionType) 18 | { 19 | using (var ctx = new SteelServices.DocContext()) 20 | { 21 | Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern obj = Utils.GetObject(screwBolts.Handle) as Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern; 22 | if (obj != null) 23 | { 24 | obj.AssemblyLocation = (AtomicElement.eAssemblyLocation)connectionType; 25 | return screwBolts; 26 | } 27 | else 28 | { 29 | throw new System.Exception("failed to get the connection object"); 30 | } 31 | } 32 | } 33 | 34 | /// 35 | /// Get assembly location: Unkown = -1, 0 = On Site, 1 = Site Drilled, 2 = In Shop 36 | /// 37 | /// Input connection object 38 | /// An integer that represents the assembly location 39 | public static int GetBoltAssemblyLocation(AdvanceSteel.Nodes.SteelDbObject screwBolts) 40 | { 41 | int ret = -1; 42 | using (var ctx = new SteelServices.DocContext()) 43 | { 44 | if (screwBolts != null) 45 | { 46 | Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern obj = Utils.GetObject(screwBolts.Handle) as Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern; 47 | if (obj != null) 48 | { 49 | ret = (int)obj.AssemblyLocation; 50 | } 51 | else 52 | { 53 | throw new System.Exception("failed to get the connection object"); 54 | } 55 | } 56 | else 57 | throw new System.Exception("Steel Object or Point is null"); 58 | } 59 | return ret; 60 | } 61 | 62 | /// 63 | /// Set orientation for anchor bolt object 64 | /// 65 | /// Input anchor bolts object 66 | /// Input Anchor Bolt Orientation location 67 | /// The updated object 68 | public static SteelDbObject SetAnchorBoltOrientation(SteelDbObject anchorBolts, int orientation) 69 | { 70 | using (var ctx = new SteelServices.DocContext()) 71 | { 72 | Autodesk.AdvanceSteel.Modelling.AnchorPattern obj = Utils.GetObject(anchorBolts.Handle) as Autodesk.AdvanceSteel.Modelling.AnchorPattern; 73 | if (obj != null) 74 | { 75 | obj.OrientationType = (Autodesk.AdvanceSteel.Modelling.AnchorPattern.eOrientationType)orientation; 76 | return anchorBolts; 77 | } 78 | else 79 | { 80 | throw new System.Exception("failed to get the connection object"); 81 | } 82 | } 83 | } 84 | 85 | /// 86 | /// Get anchor bolt orientation type: NormalOrientation = 0, 1 = DiagonalInside, 2 = DiagonalOutside, 3 = AllOutside, 4 = AllInside, 5 = InsideRotated, 6 = OutsideRotated 87 | /// 88 | /// Input anchor bolts object 89 | /// An integer that represents the orientation 90 | public static int GetAnchorBoltOrientation(AdvanceSteel.Nodes.SteelDbObject anchorBolts) 91 | { 92 | int ret = -1; 93 | using (var ctx = new SteelServices.DocContext()) 94 | { 95 | if (anchorBolts != null) 96 | { 97 | Autodesk.AdvanceSteel.Modelling.AnchorPattern obj = Utils.GetObject(anchorBolts.Handle) as Autodesk.AdvanceSteel.Modelling.AnchorPattern; 98 | if (obj != null) 99 | { 100 | ret = (int)obj.OrientationType; 101 | } 102 | else 103 | { 104 | throw new System.Exception("failed to get the connection object"); 105 | } 106 | } 107 | else 108 | throw new System.Exception("Steel Object or Point is null"); 109 | } 110 | return ret; 111 | } 112 | 113 | /// 114 | /// Get weight from the steel object 115 | /// 116 | /// Input steel object 117 | /// The weight from the steel object 118 | public static double GetWeight(AdvanceSteel.Nodes.SteelDbObject steelObject) 119 | { 120 | double ret = 0; 121 | using (var ctx = new SteelServices.DocContext()) 122 | { 123 | if (steelObject != null) 124 | { 125 | ret = Utils.GetWeight(steelObject.Handle, 0); 126 | } 127 | else 128 | throw new System.Exception("Steel Object or Point is null"); 129 | } 130 | return Utils.FromInternalWeightUnits(ret, true); 131 | } 132 | } 133 | } -------------------------------------------------------------------------------- /src/AdvanceSteelNodes/Grating/BarGrating.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AdvanceSteel.Nodes.Plates; 3 | using Autodesk.AdvanceSteel.CADAccess; 4 | using Autodesk.DesignScript.Runtime; 5 | using DynGeometry = Autodesk.DesignScript.Geometry; 6 | using SteelGeometry = Autodesk.AdvanceSteel.Geometry; 7 | using SteelServices = Dynamo.Applications.AdvanceSteel.Services; 8 | using Autodesk.AdvanceSteel.ConstructionTypes; 9 | using System.Collections.Generic; 10 | using Autodesk.AdvanceSteel.Geometry; 11 | using System.Linq; 12 | 13 | namespace AdvanceSteel.Nodes.Gratings 14 | { 15 | /// 16 | /// Advance Steel Bar Grating Pattern 17 | /// 18 | [DynamoServices.RegisterForTrace] 19 | public class BarGrating : GraphicObject 20 | { 21 | internal BarGrating() 22 | { 23 | } 24 | 25 | internal BarGrating(Vector3d vNormal, Point3d ptCenter, double dLength, List additionalGratingParameters) 26 | { 27 | lock (access_obj) 28 | { 29 | using (var ctx = new SteelServices.DocContext()) 30 | { 31 | List defaultData = additionalGratingParameters.Where(x => x.Level == ".").ToList(); 32 | List postWriteDBData = additionalGratingParameters.Where(x => x.Level == "Z_PostWriteDB").ToList(); 33 | 34 | Autodesk.AdvanceSteel.Geometry.Plane plane = new Plane(ptCenter, vNormal); 35 | Autodesk.AdvanceSteel.Modelling.Grating gratings = null; 36 | string handle = SteelServices.ElementBinder.GetHandleFromTrace(); 37 | 38 | if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) 39 | { 40 | 41 | gratings = new Autodesk.AdvanceSteel.Modelling.Grating("ADT", 11, 2, "3 / 16 inch", "10", "3/16", plane, ptCenter, dLength); 42 | 43 | if (defaultData != null) 44 | { 45 | Utils.SetParameters(gratings, defaultData); 46 | } 47 | 48 | gratings.WriteToDb(); 49 | 50 | if (postWriteDBData != null) 51 | { 52 | Utils.SetParameters(gratings, postWriteDBData); 53 | } 54 | } 55 | else 56 | { 57 | gratings = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Grating; 58 | if (gratings != null && gratings.IsKindOf(FilerObject.eObjectType.kGrating)) 59 | { 60 | gratings.DefinitionPlane = plane; 61 | gratings.SetLength(dLength, true); 62 | 63 | if (defaultData != null) 64 | { 65 | Utils.SetParameters(gratings, defaultData); 66 | } 67 | 68 | if (postWriteDBData != null) 69 | { 70 | Utils.SetParameters(gratings, postWriteDBData); 71 | } 72 | } 73 | else 74 | { 75 | throw new System.Exception("Not a Bar Grating pattern"); 76 | } 77 | } 78 | Handle = gratings.Handle; 79 | SteelServices.ElementBinder.CleanupAndSetElementForTrace(gratings); 80 | } 81 | } 82 | } 83 | /// 84 | /// Create an Advance Steel Bar Grating 85 | /// 86 | /// Input Dynamo Line 87 | /// Input Dynamo Vector to set Normal of Grating 88 | /// Optional Input Grating Build Properties 89 | /// grating 90 | public static BarGrating ByLine(Autodesk.DesignScript.Geometry.Line line, 91 | Autodesk.DesignScript.Geometry.Vector planeDirection, 92 | [DefaultArgument("null")] List additionalGratingParameters) 93 | { 94 | var start = Utils.ToAstPoint(line.StartPoint, true); 95 | var end = Utils.ToAstPoint(line.EndPoint, true); 96 | var refPoint = start + (end - start) * 0.5; 97 | var planeNorm = Utils.ToAstVector3d(planeDirection, true); 98 | 99 | if (!planeNorm.IsPerpendicularTo(Utils.ToAstVector3d(line.Direction, true))) 100 | { 101 | throw new System.Exception("Plan Direction must be perpendicular to line"); 102 | } 103 | 104 | additionalGratingParameters = PreSetDefaults(additionalGratingParameters); 105 | return new BarGrating(planeNorm, refPoint, Utils.ToInternalDistanceUnits(line.Length, true), additionalGratingParameters); 106 | } 107 | 108 | private static List PreSetDefaults(List listGratingData) 109 | { 110 | if (listGratingData == null) 111 | { 112 | listGratingData = new List() { }; 113 | } 114 | return listGratingData; 115 | } 116 | 117 | [IsVisibleInDynamoLibrary(false)] 118 | public override Autodesk.DesignScript.Geometry.Curve GetDynCurve() 119 | { 120 | lock (access_obj) 121 | { 122 | using (var ctx = new SteelServices.DocContext()) 123 | { 124 | var grating = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.Grating; 125 | 126 | if (grating == null) 127 | { 128 | throw new Exception("Null Variable Grating pattern"); 129 | } 130 | 131 | List polyPoints = GratingDraw.GetPointsToDraw(grating); 132 | 133 | return Autodesk.DesignScript.Geometry.Polygon.ByPoints(polyPoints); 134 | } 135 | } 136 | } 137 | } 138 | } 139 | 140 | -------------------------------------------------------------------------------- /src/DynamoAdvanceSteel/DynamoAdvanceSteel.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {DD6E77D3-94AC-4D22-95EA-67708F4A0A4A} 7 | Dynamo.Applications 8 | false 9 | true 10 | true 11 | CS0067 12 | 13 | 14 | 15 | $(ACADAPI)\accoremgd.dll 16 | False 17 | 18 | 19 | $(ACADAPI)\acdbmgd.dll 20 | False 21 | 22 | 23 | $(ACADAPI)\acmgd.dll 24 | False 25 | 26 | 27 | $(ACADAPI)\AdWindows.dll 28 | False 29 | 30 | 31 | $(ADVANCESTEELAPI)\ASMgd.dll 32 | False 33 | 34 | 35 | $(ADVANCESTEELAPI)\ASSettingsMgd.dll 36 | False 37 | 38 | 39 | $(ADVANCESTEELAPI)\ASSettings.dll 40 | False 41 | 42 | 43 | $(ADVANCESTEELAPI)\Extensions\DotNetRoots.dll 44 | False 45 | 46 | 47 | $(ADVANCESTEELAPI)\ASCADLinkMgd.dll 48 | False 49 | 50 | 51 | $(ADVANCESTEELAPI)\ASGeometryMgd.dll 52 | False 53 | 54 | 55 | $(ADVANCESTEELAPI)\ASObjectsMgd.dll 56 | False 57 | 58 | 59 | $(ADVANCESTEELAPI)\ASProfilesMgd.dll 60 | False 61 | 62 | 63 | $(ADVANCESTEELAPI)\ASNetRuntime.dll 64 | False 65 | 66 | 67 | $(DYNAMOAPI)\DSCoreNodes.dll 68 | False 69 | False 70 | 71 | 72 | $(DYNAMOAPI)\DynamoServices.dll 73 | False 74 | False 75 | 76 | 77 | $(DYNAMOAPI)\DynamoCoreWpf.dll 78 | False 79 | 80 | 81 | $(DYNAMOAPI)\DynamoShapeManager.dll 82 | False 83 | 84 | 85 | $(DYNAMOAPI)\DynamoCore.dll 86 | False 87 | False 88 | 89 | 90 | $(DYNAMOAPI)\DynamoUtilities.dll 91 | False 92 | False 93 | 94 | 95 | $(DYNAMOAPI)\DynamoInstallDetective.dll 96 | False 97 | False 98 | 99 | 100 | $(DYNAMOAPI)\Greg.dll 101 | False 102 | False 103 | 104 | 105 | $(DYNAMOAPI)\RestSharp.dll 106 | False 107 | False 108 | 109 | 110 | $(DYNAMOAPI)\ProtoCore.dll 111 | False 112 | False 113 | 114 | 115 | $(DYNAMOAPI)\ProtoGeometry.dll 116 | False 117 | False 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | --------------------------------------------------------------------------------