LetsConstructIT / Grasshopper-TeklaDrawingLink

Grasshopper components for interacting with Tekla drawing area
MIT License
50 stars 6 forks source link

how to create mulitdrawing #40

Open better319 opened 2 months ago

better319 commented 2 months ago

how to create mulitdrawing

olszewski-grzegorz commented 2 months ago

Hi @better319 ! Unfortunately, there is no support for multidrawing creation in the Tekla Open API :/ If official API is not supporting this, then Drawing Link won't help.

But ... it can be somehow bypassed with macros like (but it will be quite hard to control the whole process):

pragma warning disable 1633 // Unrecognized #pragma directive

pragma reference "Tekla.Macros.Wpf.Runtime"

pragma reference "Tekla.Macros.Runtime"

pragma warning restore 1633 // Unrecognized #pragma directive

namespace UserMacros { public sealed class Macro { [Tekla.Macros.Runtime.MacroEntryPointAttribute()] public static void Run(Tekla.Macros.Runtime.IMacroRuntime runtime) { Tekla.Macros.Wpf.Runtime.IWpfMacroHost wpf = runtime.Get(); wpf.InvokeCommand("CommandRepository", "Drawing.CreateEmptyMultiDrawing"); } } }

pragma warning disable 1633 // Unrecognized #pragma directive

pragma reference "Tekla.Macros.Wpf.Runtime"

pragma reference "Tekla.Macros.Runtime"

pragma warning restore 1633 // Unrecognized #pragma directive

namespace UserMacros { public sealed class Macro { [Tekla.Macros.Runtime.MacroEntryPointAttribute()] public static void Run(Tekla.Macros.Runtime.IMacroRuntime runtime) { Tekla.Macros.Wpf.Runtime.IWpfMacroHost wpf = runtime.Get(); wpf.InvokeCommand("CommandRepository", "Drawing.CreateMultiDrawing.FromSelectedDrawings"); } } }

pragma warning disable 1633 // Unrecognized #pragma directive

pragma reference "Tekla.Macros.Wpf.Runtime"

pragma reference "Tekla.Macros.Runtime"

pragma warning restore 1633 // Unrecognized #pragma directive

namespace UserMacros { public sealed class Macro { [Tekla.Macros.Runtime.MacroEntryPointAttribute()] public static void Run(Tekla.Macros.Runtime.IMacroRuntime runtime) { Tekla.Macros.Wpf.Runtime.IWpfMacroHost wpf = runtime.Get(); wpf.View("DocumentManager.MainWindow").Find("AID_DOCMAN_DataGridControl").As.ContextMenu.Find("AID_DocMgr_LinkDrawingViews").As.Button.Invoke(); } } }

But I don't believe in succesful wiring above macros. What exactly would like to achieve? What is your typical workflow with multidrawings?

better319 commented 2 months ago

i just wanna select some similar parts to create the multidrawings , maybe that another way to realize it。 THK!!