GC copycat proliferation?

With the latest anouncements by Siemens and Nemetchek, I think just about all the major CAD apps have an algorithmic / visual scripting addon.

  1. Rhino: Grasshopper
  2. ACAD: DesignScript, Dynamo
  3. Revit: Dynamo, Grasshopper
  4. Vectorworks: Marionette
  5. Catia: xGenerative Design
  6. Sketchup: VizPro
  7. BricsCAD: Grasshopper
  8. ArchiCAD: Grasshopper / Parem-o
  9. Allplan: Visual Scripting
  10. Siemens NX: Algorithmic Modeling
  11. BlenderBIM: Sverchok

Makes me wonder if the old BIM v. CAD comparisons will start to fade away as more and more CAD apps start exposing their contents to data-centric manipulation via visual scripting interfaces.

Parents
  • HI Dominic,

    Good to see lots of Visual Scripting tools out there. The computational design workflow is getting popular I believe. It would be interesting to see the type of geometry they support and the automation that can be done with the parent application and also the ability of external data manipulation. 

  • It would be interesting to see the type of geometry they support

    This is of course dependent on the base app. In the past, GC's solids has been touted as an advantage over GH, and GC is generally recognised as better than Dynamo when comes to geometry. This seems to be still be case with Dynamo in ACAD. No splines or Nurbs? Also interesting that Dynamic Blocks are on the way. I read somewhere that GC is currently looking to integrate better with Parametric Cells. Future parity?

    and the automation that can be done with the parent application

    Interesting to note that Dynamo integration starts with getting selection nodes in first. These nodes have always been one big advatange of Dynamo on Revit as it allowed Dynamo access and manipulate a lot of the model / drawing elements in a 'BIM' way. Mstn has in the past relied on VBA / COM for this which is not as visible and easy to pick up. I hope that Bentley will take notice here.

    There is mention of Python for GC in future. It might be good to leverage VBA better in GC... which seems to be still going strong and has a built in IDE.

    All that EC Framework schema stuff sound like all anything in Mstn should be 'aligned' for easy access by GC for 'BIM'-like manipulation. OTOH, looking at how long it took to integrate Aecosim, I suspect that most of the verticals are still using COM or do not have a public APIs for their graphic objects or expose their schemas the way some verticals like OpenPlant or Bentley Map do. 

    PokeIt demonstrates that accessing Mstn is scriptable via VBA. What would be great is something equivalent for all the verticals? PokeIT for OBD should be a quick exercise, given TF.COM? This would help a lot of 'power' users get past trying to get their heads around selecting and processing OBD elements. Something that lets even 'average' Revit users look clever... using Dynamo.

    and also the ability of external data manipulation. 

    Not sure what you mean here. Do you mean external data in Excel or an external database? Or something like IFC?

    AFAIK, Dynamo does not have any official nodes for database manipulation. There are some third-party packages. Probably, slower than what GC has..., zero-touch notwithstanding?

    As mentioned, a lot of what is sold as 'BIM' productivity is really just 'bulk-editing' using automation tools like scripting. Parametrics is also sold as a 'BIM' productivity feature as it enables 'bulk' or 'Excel-like' editing. Both have been used to persuade users to jump platforms, dumping 'dumb' CAD for 'smart' BIM.

  • using System;
    using System.Windows;
    using System.Collections.Generic;
    using System.ComponentModel;
    using Bentley.GenerativeComponents;
    using Bentley.GenerativeComponents.AddInSupport;
    using Bentley.GenerativeComponents.Features;
    using Bentley.GenerativeComponents.GCScript;
    //using Bentley.GenerativeComponents.GCScript.NameScopes;
    //using Bentley.GenerativeComponents.GeneralPurpose;
    //using Bentley.GenerativeComponents.MicroStation;
    using Bentley.GenerativeComponents.View;
    using Bentley.DgnPlatformNET;
    using Bentley.MstnPlatformNET;
    using Bentley.DgnPlatformNET.DgnEC;
    using Bentley.ECObjects.Schema;
    using Bentley.ECObjects.Instance;
    
    namespace GCCommunity
    {
        [GCNamespace("User")]
        [NodeTypePaletteCategory("Custom")]
        [NodeTypeIcon("Resources/Items.png")]
        [Summary("Read, attach and update item properties on elements.")]
    
        public class ItemTypes : Feature
        {
            [DefaultTechnique]
            [Summary("Read Items that are attached to the input elements.")]
            [Parameter("ElementsToRead", "Input elements to read from.")]
            [Parameter("ItemTypeName", "The Item Type.")]
    
            public NodeUpdateResult ReadItems
            (
                NodeUpdateContext updateContext,
                [Replicatable, DgnModelProvider] object ElementsToRead/*,
                [Out, Replicatable] ref string[] ItemTypeName,
                [Out, Replicatable] ref string[][] PropertyNames,
                [Out, Replicatable] ref string[][] PropertyValues*/
            )
                
            {/*
                try
                {
                    DgnFile dgnFile = Session.Instance.GetActiveDgnFile();
                    DgnModel dgnModel = Session.Instance.GetActiveDgnModel();
    
                    Feature feat = (Feature)ElementsToRead;
                    long eleID = feat.ComElement().ID;
                    Bentley.DgnPlatformNET.Elements.Element ele = dgnModel.FindElementById(new ElementId(ref eleID));
                    
                    CustomItemHost customItemHost = new CustomItemHost(ele, false);
    
                    IList<IDgnECInstance> ecInstanceList = customItemHost.CustomItems;
    
                    List<string> types = new List<string>();
                    List<string[]> props = new List<string[]>();
                    List<string[]> values = new List<string[]>();
    
                    foreach (IDgnECInstance ecInstance in ecInstanceList)
                    {
                        types.Add(ecInstance.ClassDefinition.Name);
    
                        List<string> iprops = new List<string>();
                        List<string> ivalues = new List<string>();
    
                        IEnumerator<IECPropertyValue> ie = ecInstance.GetEnumerator(true, true);
                        while (ie.MoveNext())
                        {
                            iprops.Add(ie.Current.Property.Name);
                            ivalues.Add(ie.Current.StringValue);
                        }
    
                        props.Add(iprops.ToArray());
                        values.Add(ivalues.ToArray());
                    }
    
                    PropertyNames = props.ToArray();
                    PropertyValues = values.ToArray();
                }
                catch (Exception ex)
                {
                    return new NodeUpdateResult.TechniqueException(ex);
                }
                */
                return NodeUpdateResult.Success;
            }
    
            [Technique]
            [Summary("Write new values to Items on the input elements.")]
            [Parameter("Elements", "Input elements to write to.")]
            public NodeUpdateResult WriteItems
            (
                NodeUpdateContext updateContext,
                [DgnModelProvider, Replicatable] object ElementsToWriteTo,
                [Replicatable] string ItemTypeLibraryName,
                [Replicatable] string ItemTypeName,
                [Replicatable(-1, true)] string[] PropertyName,
                [Replicatable(-1, true)] string[] PropertyValue
            )
            {
                try
                {
                    DgnFile dgnFile = Session.Instance.GetActiveDgnFile();
                    DgnModel dgnModel = Session.Instance.GetActiveDgnModel();
    
                    Feature feat = (Feature)ElementsToWriteTo;
                    long eleID = feat.ComElement().ID;
                    Bentley.DgnPlatformNET.Elements.Element ele = dgnModel.FindElementById(new ElementId(ref eleID));
    
                    
                    ItemTypeLibrary itl = ItemTypeLibrary.FindByName(ItemTypeLibraryName, dgnFile);
                    ItemType itemType = itl.GetItemTypeByName(ItemTypeName);
    
                    CustomItemHost customItemHost = new CustomItemHost(ele, false);
    
                    IDgnECInstance ecInstance = customItemHost.GetCustomItem(ItemTypeLibraryName, ItemTypeName);
                    if (ecInstance == null)
                    {
                        ecInstance = customItemHost.ApplyCustomItem(itemType);
                    }
                    for (int i = 0; i < PropertyName.Length; i++)
                    {
                        ecInstance.SetString(PropertyName[i].ToString(), PropertyValue[i].ToString());
                    }
                    ecInstance.WriteChanges();
                }
                catch (Exception ex)
                {
                    return new NodeUpdateResult.TechniqueException(ex);
                }
                            
                return NodeUpdateResult.Success;
            }
    
            [Technique]
            [Summary("Attach an ItemTypeLibrary to the input elements.")]
            [Parameter("Elements", "Input elements to write to.")]
            public NodeUpdateResult AttachItems
            (
                 NodeUpdateContext updateContext,
                 [DgnModelProvider, Replicatable] object ElementsToAttachTo,
                 [Replicatable] string ItemTypeLibraryName,
                 [Replicatable] string ItemTypeName
    )
            {
                try
                {
                    DgnFile dgnFile = Session.Instance.GetActiveDgnFile();
                    DgnModel dgnModel = Session.Instance.GetActiveDgnModel();
    
                    Feature feat = (Feature)ElementsToAttachTo;
                    long eleID = feat.ComElement().ID;
                    Bentley.DgnPlatformNET.Elements.Element ele = dgnModel.FindElementById(new ElementId(ref eleID));
    
    
                    ItemTypeLibrary itl = ItemTypeLibrary.FindByName(ItemTypeLibraryName, dgnFile);
                    ItemType itemType = itl.GetItemTypeByName(ItemTypeName);
    
                    CustomItemHost customItemHost = new CustomItemHost(ele, false);
    
                    IDgnECInstance ecInstance = customItemHost.GetCustomItem(ItemTypeLibraryName, ItemTypeName);
                    if (ecInstance == null)
                    {
                        ecInstance = customItemHost.ApplyCustomItem(itemType);
                    }
                    ecInstance.WriteChanges();
                }
                catch (Exception ex)
                {
                    return new NodeUpdateResult.TechniqueException(ex);
                }
    
                return NodeUpdateResult.Success;
            }
        }
    }

    This is my modified ItemType.cs which includes an additional Technique to just attach ItemTypes to object, without the need to write content.

    Regards

    Chris


    AECOM Roads UK&I Digital Engineering, Design & Solutions Lead | Sector Information Management Lead

    Associate Director – Digital

    OpenRoads Designer 10.12 | MicroStation 2023 | ProjectWise CE 10.3.4 | ContextCapture | ProjectWise PowerShell 2023 | ProjectWise WSG API | Generative Components | OpenBridge Designer 10.12

    Civil 3D 2023 | Dynamo | Navisworks Manage

    PowerShell | Visual Studio | Office 365 | Power Platform | Teams | SharePoint | Visio

    Speckle | BIMVision | Revizto | Solibri

  • Hopefully that works for you now Chris, it seems that they have introduced a change to the com library in the latest GC update

  • Hi Alifur,

    please could you shares the code for OBD update 7 and update 8.

    Thanks.

    Regards,

    Ganapati

  • Hi Ganapati,
    I sent you an email last week with the updates, let me know how you go with it

    Cheers,

    Ed

  • Hello Ed, 

    Thank you Ed for sharing those with Ganapati. If you need anything more please let me know. 

    Regards,
    Alifur 

Reply Children
No Data