Grasshoper to Bricscad Primitives ?

Hi all,
what geometric primitives can be "baked" (Grasshopper Function Bake) from Grasshopper to Bricscad ?
Only the exposed Bricscad BIM primitives in Grasshopper ?
Can NEW "bakeable" Bricscad primitives or grasshopper geometric primitive Components like Lines, Splines, Solid3d etc.... be developed using C# ?
Thanks, Regards

Comments

  • Lukas Fertig
    edited November 2019

    there's a "bake geometry" component with a "bake into bricscad" option when you right click the component (r-click on the dark "BG" field of the component, not the output parameter. It lets you bake plain geometry like breps and curves.

    I guess it should be possible to program your own components, i can only speak from the rhino side though, haven't tried it in bricscad yet. For Grasshopper to recognize anything you will have to inherit the correct classes to set up your component plugins and enable the data to be baked. Things to look for are IGH_Goo and IGH_GeometricGoo (those wrap custom data into grasshopper parameters). Then there are IGH_BakeAwareData/Object (here you need to override the baking methods) as well as IGH_Preview (to override the display methods for your custom data). There's plenty of developer resources on the rhino side, it would be interesting to hear from bricscad how far existing components can simply be adapted to bricscad?!

  • Hi Lukas,
    many thanks for your response ! Yes i have found the "bake into bricscad" option of the "bake geometry" component...
    I was just too quick to ask the question...
    I would appreciate some good links + documentation addressing the development of components using C# .NET
    Best Regards

  • Lukas Fertig
    edited November 2019

    Hi Konstantin,

    One thing i forgot to mention is, that you generally have the possibility to write c# / vb / python scripts in grasshopper scripting components. This might already address a lot of your needs without getting too deep into the whole rhino/grasshopper ecosystem. There are also python bindings for RhinoCommon, which are a nice start to familiarize oneself a bit with the whole environment without having to set up any big projects (open rhino and type EditPythonScripts to bring up the internal editor)..

    If you want to dig deeper, the main resource for Rhino development is this page here:

    https://developer.rhino3d.com

    The C# SDK for Rhino is called RhinoCommon, which wraps around the OpenNurbs library and provides stuff like geometric classes, file access, display conduits etc.. Grasshopper has it's own SDK. I started out using these guides for Rhinocommon and Grasshopper. The provided VS project templates work out of the box without much trouble setting them up:

    https://developer.rhino3d.com/guides/rhinocommon/
    https://developer.rhino3d.com/guides/grasshopper/

    Then there's a plethora of code samples that illustrate nicely how to use the libraries:

    https://developer.rhino3d.com/samples/
    (plus even more on github)

    When problems get more tricky and the basic samples don't cut it anymore, I've always found open source projects to have a look at how other people solved similar situations..

    As for the link to Bricscad, I'm just getting started here, maybe there's someone more experienced who can elaborate on how Grasshopper links to Bricscad? I assume through RhinoInside? (https://github.com/mcneel/rhino.inside/tree/master/Bricsys/BricsCAD) disappeared as of today

    Hope this helps.. let me know if you find out more on the bricscad side =)

  • Lukas Fertig
    edited November 2019

    update:

    I had some time to play around with GH in Bricscad. It's reasonably straightforward to make your own component use Bricscad entities and other Grasshopper components seem to work without problems. You have to relink some dll's in the project to get the whole thing built, but that's basically it. Debugging out of VS doesn't work because it fails to load a resource. If you build the component and load it into Bricscads Grasshopper it runs fine though.

    I actually wonder if going through all the hassle of writing custom components that access the Bricscad types is even necessary, as you can already read out all the BIM properties using the provided components and the BC-types seem to convert well into standard GH-types (was still fun digging into it though..).

    What would be really interesting would be the possibility to mess with layouts through Grasshopper. I had projects where I autogenerated dozens to hundreds of custom part drawings and generated the according cam paths in Rhino using Grasshopper (some wall cladding, >20000 dimensioned drillholes, figure how long that would have taken) . Unforunately Rhino's documentation tools are rather basic. Imagine having the possibility to output this kind of stuff into a sheetset!

  • Hi Lukas,
    i much appreciate your effort to answer my rather general questions!
    In your description and screenshot above you have already made a Custom Test Component ....
    Did you use C# scripts in a grasshopper scripting component by creating a project in Visual Studio ?
    Could you kindly describe in a checklist the procedure of making it, i am really new to Grasshopper C# component development
    although i have extensively programmed plug-ins for Bricscad in C# .
    Can you also attach the VS project for the Custom Test Component displayed in your screenshot above ?
    Thank you so much, kind Regards
    K

  • Lukas Fertig
    edited November 2019

    Hi Konstantin,

    to be honest, the whole effort is also out of my own interest, i just took your question as the initial kick in the b*tt to finally start looking into it. I'd been using python/c# scripting for a while to make my life easier with repetitive work and just recently started working on a grasshopper/rhino plugin. With the new possibilities in V20 I was wondering how hard it would be to also link the project to Bricscad...

    I created the custom component as follows:

    • Install the visual studio assembly templates for grasshopper (https://developer.rhino3d.com/guides/grasshopper/installing-tools-windows/)
    • manually relink all the rhino references (rhinocommon, gh_io, grasshopper) to the ones in the rhino 7 wip folder.
    • link the grasshopper for bricscad dlls that you can find in your installation folder
    • change the target environment to dotnet 4.5.1
    • quick boilerplate build to see everything works
    • have fun!

    what have you been working on for bricscad? with your bc/c# experience maybe you can find out what resource the debugger is missing..

    as for the code: everything you do in a component basically happens in these three methods:

            protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
            {
                pManager.AddParameter(new GH_BC.BcEntity());
    
            }
    
            protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
            {
                pManager.Register_StringParam("typename", "tname", "Type Name");
                pManager.Register_StringParam("typedesc", "tdesc", "Type Description");
                pManager.Register_BRepParam("brep", "brep", "Boundary Representation from BC Entity");
            }
    
            protected override void SolveInstance(IGH_DataAccess DA)
            {
                GH_BC.Types.BcEntity ent=null;
                if (!DA.GetData(0, ref ent)) return;
    
                string tn = ent.TypeName;
                string td = ent.TypeDescription;
    
                GeometryBase geo = ent.getGeometry(); 
                Brep brep = geo.Duplicate() as Brep; ///careful here, you need to duplicate the thing, also it should usually be checked for validity etc.. 
    
    
                DA.SetData(0, tn);
                DA.SetData(1, td);
                DA.SetData(2, brep);
            }
    
  • im kind of bombing this thread, but stuff gets more and more interesting: feel like using vray in bricscad? here you go...

  • Hi Lukas,
    many thanks for your description.
    I have been through all the necessary steps and been able to succesfully create the component as you did !
    So it is quite straightforward, i used VS 2019 community edition.
    You can see at https://forum.bricsys.com/discussion/comment/27718/#Comment_27718
    a plugin i created for Bricscad for dealing with BREP Solids and Surfaces.
    At that time many of the commands were not available in Bricscad at all.
    Last version in 2015....

  • tslewis71
    edited November 2019
    I have done a lot of API development in GH with linking to Excel/Tekla/Catia/sap/gsa etc.

    The new thing about what bricsys is doing is that it is running rhino and gh from within the Bricscad environment.

    This is an atypical approach in that you cannot access the Bricscad gh components form an instance of grasshopper or rhino launched outside of a bricsys session.

    If I launch rhino and gh, the Bricscad gh components are not accessible.

    I believe it is using the new “rhinoinside” api which only works with rhino 7 which is still under development.

    Having to launch grasshopper within bricsys is limiting as it does not allow gh to be an agnostic tool to hook into any application from outside,

    I don’t think the intent of rhino inside was to limit its accessibility to outside processes. This was the problem with dynamo initially with revit, you could only run dynamo form an instance of revit.

    Dynamo studio was since released which is a stand alone version of dynamo and is launched outside of revit, its stand alone.

    Currently Bricscad/GH requires the end user to have rhino 7 which is not a release version.

    Rhino 6 is the commercial version available right now. Most clients won’t have access to rhino 7 as it is not release version and IT departments won’t support it.

    Either way, I would imagine any user can develop their own bricsys custom gh components that can run in rhino 6 and not require rhino/gh to be launched from a bricsys session. Code above is what it typically write.

    I’d prefer to have gh running out of process and able to hook into any tool not be limited to a tool and run in process. That’s a major need for interoperability, hence drive for rhino inside and dynamo studio,

    Not a major issue and bricsys have a well thought approach. The gh components are robust but the manual baking approach is not good and antiquated.

    The unique thing bricsys have done is you can also preview gh geometry in bricsys, select revenge geometry interactively in bricsys and bring into gh, and essentially user doesnt need rhino at all. GH is effectively built into bricsys samr as gh is built into rhino. This is pretty novel, if limiting for interoperability outside of bricsys ... again I prefer to be able to launch agnostically outside a tool.
  • @Lukas Fertig said:
    update:

    I had some time to play around with GH in Bricscad. It's reasonably straightforward to make your own component use Bricscad entities and other Grasshopper components seem to work without problems. You have to relink some dll's in the project to get the whole thing built, but that's basically it. Debugging out of VS doesn't work because it fails to load a resource. If you build the component and load it into Bricscads Grasshopper it runs fine though.

    I actually wonder if going through all the hassle of writing custom components that access the Bricscad types is even necessary, as you can already read out all the BIM properties using the provided components and the BC-types seem to convert well into standard GH-types (was still fun digging into it though..).

    What would be really interesting would be the possibility to mess with layouts through Grasshopper. I had projects where I autogenerated dozens to hundreds of custom part drawings and generated the according cam paths in Rhino using Grasshopper (some wall cladding, >20000 dimensioned drillholes, figure how long that would have taken) . Unforunately Rhino's documentation tools are rather basic. Imagine having the possibility to output this kind of stuff into a sheetset!

    One problem im running into is that not all properties are exposed in the curent BG GH components, essential ones like beam axis rotation for instance so one cannot modify an existing bricsys bim model if member orientations need to be changed pro grammatically. Also BC GH links only run within the bricsys environment which is why the debugger is likely not working. Usually we always debug the normal way with GH running within Rhino. Rhino7 i guess is using RhinoInside...

  • I posted the exact same comments as you above - had some response. I guess the alternative is to build your own bricsys components that run within rhino and grasshopper and hook outside into bricsys. Debugging is essential