13 April 2022

How to use Orchid in Python

Some would state that this was about time, and why have we been waiting so long!?

Well, to be honest, I have found it extremely problematic that The Dynamo Team at Autodesk always has hidden several classes, and still does hide several classes, by setting the wrapped objects as internal.
This has always made me a kind of angry and made me decide that I would shield my classes as well so everyone who was asking “but why?” I would reply “Make the team change and I will change!”
However, we do all know that nothing coherent to Autodesk is changing anything, they do only maintenance. And if they change something, it is surely not what users/customers want!

Now some years have passed and I wondered why should I be the same as them!? Why should I not be a larger person than that team... this is why I now have opened all my classes for transfering data to the Autodesk API. However, there are still some things to consider, and this is why I make my setter private to prevent unintended breakdowns. All my classes that return Orchid elements do now return Autodesk elements by the keyword WrappedType.

An example on a class from the dynamo team
namespace Revit.Elements
{
    public class Parameter
    {
        internal Autodesk.Revit.DB.Parameter InternalParameter
        {
            get;
            set;
        }


An example on a class from the Orchid package
namespace Orchid.RevitProject.Common
{
    public class Document
    {
        public Autodesk.Revit.DB.Document WrappedType { get; private set; }


An example on how to use the Orchid package combined with Python.

04 November 2021

Move an entire model and its views #2

Once more I have made some functions which might interest others.

Since I released the nodes for moving objects and views, published in this post 1,5 years ago has many things have been improved. There are still some issues when moving elements where Revit “complains” about elements are being unjoined, however, after moving are the same elements being auto joined again!? Like some constraints will be unconstrained, and some groups need to be fixed.
However, it seems to be smaller issues compared to being able to control the model location at some tangible element or point rather than 0,0,0 is somewhere unknown!

The latest functions developed for this are moving elements in a workshared environment with or without designoptions.

Single model
Workshared model

18 April 2021

PDF export nodes

With the arrival of Revit 2022 has it finally become an option to export view to PDF format. This new feature has also arrived in the Orchid nodes which now support exporting into pdf files.


16 September 2019

Setting ViewTemplate

Do you use view templates to control views, I do. Especially do I use view templates for views there is put on sheets. Therefore does the latest build contain a series of nodes for view templates. Besides are nodes for views extended.


25 June 2019

Move an entire model and its views


Have you ever witness the challenge of working with a model that is started by someone who didn’t know the importance of controlling the project origin!?

As a university and an estate owner do we inherit many models made in projects where the scenario is that someone forgot to control this at an early stage so the model could have been corrected. First when the project comes to the handover phase is it then discovered that this very critical error occurs.

Therefore, I took this challenge to code the bits and pieces to be able to move an entire model including moving elevations, sections, detailing, and 3D views, etc., also including adjustments for grids, crop boxes, views location on sheets. All in all, everything inside the project should be transformed by a given vector.

This work made me walk along many paths, developing a variety of nodes for grouping, views, viewports, and grids. More than 25 nodes have been created.

However, In the final scenario, I ended up only using a few of these nodes, while I continuously tried to figure smarter and smarter ways to tweak data. The nodes developed along the way is released also, while these could be used for other purposes and/or minor other tasks than moving the entire project.


move to origin (the final graph)

---
nodes for spatial element (room, space, and area)

nodes for view, viewport etc.


nodes for grouping etc.

nodes for grids etc.





24 April 2019

Minor release 134.5.0 / 202.5.0 and major release 210.0.0


Revit 2020 (and Dynamo 2.1) has been released and therefore have I released my package for 2.1.x series. This has a huge impact on all version of the Orchid package since a large reshuffle of node locations has taken place.

Unfordenetly is the problems concerning migration not being solved with the Dynamo 2.1 release, however, it was not viable any longer to wait for a fix of the migration problem while it was slowing down my development.

This rather big issue will give users errors, and the only thing I can suggest is to address complains over this error towards the dynamo team at dynamobim.com forum and/or DynamoDS gitHub. I don’t find it suitable that I should correct this error, this must be an Autodesk issue.

26 March 2019

BuiltInParameter, Transfer/Copy, central/linked files

In this update have I added several new features in different areas.

Nodes for BuiltInParameter

Nodes for copying and transferring elements between different document

Nodes for opening, save and closing central files

Nodes for linking files into documents

15 March 2019

Graphs...

I have seen it over and over again. Users calling Dynamo "graphs" as "scripts". Sorry but this is not what it is!

What we do with Dynamo is much smarter, it is directed graph technology. It is a much higher order way to do (visual) programming, than simple scripts known from ex. Java scripts, or even the way Python scripts is widely used in Custom Nodes... or scripts in Code Blocks.

Naming it "scripts" is to patronize what we actually do.

https://en.wikipedia.org/wiki/Directed_acyclic_graph
https://en.wikipedia.org/wiki/Visual_programming_language
https://en.wikipedia.org/wiki/Graph_rewriting


Try also to open a dynamo 1.3 file in a text editor...
<Connectors>
  <Dynamo.Graph.Connectors.ConnectorModel ... />
</Connectors>


Or take a look at the Dynamo Primer...


...and from https://primer.dynamobim.org/13_Best-Practice/13-2_Graph-Strategies.html

Reduce Complexity
As you develop your Dynamo graph and test ideas, it can quickly grow in size and complexity. While it is important that you create a functioning program, it is equally important to do it as simply as possible. Not only will your graph run faster and more predictably, you along with other users will understand its logic later on. The following are several ways that will help you clarify the logic of your graph.

[...]


Maintain Readability

In addition to making your graph as simple and efficient as possible, strive for graphic clarity. Despite your best efforts to make your graph intuitive with logical groupings, relationships might not be readily apparent. A simple Note inside of a Group or renaming a slider can save you or another user from unnecessary confusion or panning across the graph. The following are several ways that will help you apply graphic consistency within and across your graphs.


It does matter to use a "language" thoroughly. Giving up language is giving up the core of whatever a culture stands for. Therefore, I don’t think it is a good idea to let "slang" become the language!

Please let us use the right notation... it is graphs, not scripts!

10 March 2019

New nodes for materials

The update x.4.1 includes a new branch for “Materials” and +100 new nodes handling generic material-, graphical-, appearance-, physical-, and thermal assets.

Material general


Graphics


Physical and Thermal


Appearance

25 February 2019

IFC export and some other new nodes

The major update release (134.4.0 and 202.4.0) includes nodes for IFX export.
The nodes is build using the API from the IFC exporter 18.4.0 (for dynamo 1.3.x) and 19.1.0 (for dynamo 2.0.x), meaning the exporter must be installed to use these nodes!



Building the exporter nodes made me realize that some project nodes also was needed


Dropdown for families in the project and selection of all elements by family in the document added.


String.Substring and String.Replace added, these takes lists as input!
can be used for "manually" migration of dynamo files
https://forum.dynamobim.com/t/dynamocore/31912/13
https://forum.dynamobim.com/t/migrate-custom-nodes-to-zero-touch-nodes/31585/8



09 February 2019

Open new view ... active view

I have made a node for opening a new view, this new view will then be the active view when the graph is finished and the dynamo application again is idle. However, this is only one half of what I would like to be able to do with my node. My goal was to be able to close the other open windows in the same process.

That is not possible at the moment due to the way Dynamo works. If it should be possible I need the ability to use events inside a method in Dynamo like this post by Jeremy Tammik describes.

Therefore, is the workaround at the moment as following. Add the “OpenView” node in a graph and then execute the graph and do whatever is needed. When you eventually has finished doing whatever you should, then save and closes the file.

When the file is re-open will the last view be the default view unless starting view is set, in that case, will it be the starting view and that would be correct in those cases.

This new node cannot be called as a background action!

04 February 2019

Associate and Category

Orchid version 134.3.11 / 202.3.11 has been released.
The latest update includes a larger extension of nodes for association.

New node for nested associated elements in families (orange box in image) and node for parameters to verify if "HasAssociated" elements.

Association for global parameters. Associate, GetAssociate and HasAssociated.

Verify if "Family" and FamilyType" has associated elements

Several nodes for Category. Get all built in categories, categories in document, categories by category type and lastly get the category type from categories.

New node for SetType. The node takes an "element" and a "familyType". the element gets the "FamilyType". This can be used when elements need a new type ex. when randomizing. Besides is two new nodes for random created. These nodes take a "range" and return random number(s) in the range. The OOTB node gives the random number in the range 0 to 1.

03 February 2019

Migrate Custom Nodes to Zero Touch nodes

Yet another time has a user problems in migrating a graph using Custom Nodes which are deprecated to the comparative Zero Touch node. It seems there still exist users who cling to to my long-gone DanEDU package which was a CN based package because it is a job to migrate it using my new ZT based package (Orchid)

I have tried if there was any possibility to add old CN nodes in my migration, but that is not possible.

However, I did try to solve this issue for the user, and figured that it is doable to do a “manually” migration using a notepad editor, and it was not that difficult...

It is a good idea to make a dummy file with the corresponding nodes you want to use because you need to know where the assemblies are stored and what the names are, the easiest is to create a graph with the nodes you know you need and then open this file in a notepad so you have the strings you need to replace values with!

The below example is from a 1.3.x graph, since the old graph most likely is from the era with the old layout before the 2.0.x versions.

The below is the node "List.Clean|DanEDU"
<Dynamo.Graph.Nodes.CustomNodes.Function guid="e4e4649b-af37-41d3-bde8-29c4e9181d4a" type="Dynamo.Graph.Nodes.CustomNodes.Function" nickname="List.Clean|DanEDU" x="281.221049098559" y="999.174659610855" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" IsFrozen="false" isPinned="false">
  <PortInfo index="0" default="False" />
  <PortInfo index="1" default="True" />
  <ID value="f39ad724-9216-46d6-9cfc-0e9bb8a71360" />
  <Name value="List.Clean|DanEDU" />
  <Description value="Remove empty list, null and blank values
- former named as RemoveNull" />
  <Inputs>
    <Input value="list" />
    <Input value="searchFor" />
  </Inputs>
  <Outputs>
    <Output value="list" />
  </Outputs>
</Dynamo.Graph.Nodes.CustomNodes.Function>

The below is the ZT node “List.Clean” in the Orchid package
<Dynamo.Graph.Nodes.ZeroTouch.DSFunction guid="f166a310-a158-4778-b709-8eb190e878c8" type="Dynamo.Graph.Nodes.ZeroTouch.DSFunction" nickname="List.Clean" x="-0.0783702393594012" y="999.174659610855" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" IsFrozen="false" isPinned="false" assembly="..\..\AppData\Roaming\Dynamo\Dynamo Revit\1.3\packages\Orchid\bin\OrchidGeneric.dll" function="Orchid.Generic.Core.List.Clean@var[]..[],var[]..[]">
  <PortInfo index="0" default="False" />
  <PortInfo index="1" default="True" />
</Dynamo.Graph.Nodes.ZeroTouch.DSFunction>
The most important part to keep is the guid mention in the first line after the function, ex. guid="e4e4649b-af37-41d3-bde8-29c4e9181d4a". The guid is the id used in the graph as the connector!
example where a “codeblock” with the connector guid="f7fc68c8-1239-46d9-848c-ef958450c6de" connects to the “List.Clean|DanEDU” node
<Dynamo.Graph.Connectors.ConnectorModel start="f7fc68c8-1239-46d9-848c-ef958450c6de" start_index="0" end="e4e4649b-af37-41d3-bde8-29c4e9181d4a" end_index="0" portType="0" />

Therefore be exceptional observant towards these guid’s!
Likewise do not change the x, y position for the node ex.
x="281.221049098559" y="999.174659610855"

REPLACE to “List.Clean” node
The first string to replace is Dynamo.Graph.Nodes.CustomNodes.Function with Dynamo.Graph.Nodes.ZeroTouch.DSFunction
-– this will replace all the CN nodes functions!!! -–
Next string to replace is nickname="List.Clean|DanEDU" with nickname="List.Clean"
Then add the assembly in the end of the line with isPinned="false">
extend this to isPinned="false" assembly="..\..\AppData\Roaming\Dynamo\Dynamo Revit\1.3\packages\Orchid\bin\OrchidGeneric.dll" function="Orchid.Generic.Core.List.Clean@var[]..[],var[]..[]">
Move on to the other nodes, replacing only the last two strings per node!
Thats it... all the other strings from the “old” node will be removed when you open the graph, then you are good to go...

Try this out by your self...

danedu nodes.dyn
danedu nodes-migrated.dyn




This post is originally published at dynamobim.org

21 January 2019

HasAssociated and Convert

New release there includes some new nodes...

Check if family parameter has associated element (...in upper right corner).
PostEdit: Associate nodes is updated


Node there converts shared parameters to family parameters.

After the last update of all family document nodes, is all nodes also updated changing the output to the most suited instead of document as output.

This post is originally published at dynamobim.org

AddIfcParameters and updates

Orchid version 134.3.10 / 202.3.10 has been released.

The largest change in this version is that the package has been refactored to comply with naming conventions.

The next largest change is all FamilyDocument nodes don’t pass the document as an output, likewise, other nodes there passed project documents. I have made this rather large change to be able to support ”ListLevel” better, I have noticed many users have problems understanding that the output changes dramatically for passing the opened document when list level is used. Therefore do all now need to use the DataStream.Await to let documents being passed.

Updated family document example...

One of the new nodes is AddIfcParameters, this one adds the four most important IFC parameters.
Parameters are found in the IFC Shared Parameters.txt that works together with the Revit IFC exporter! 
http://help.autodesk.com/view/RVT/2019/ENU/?guid=GUID-7119A8C3-A0EE-4568-8C35-750410D867C9
https://github.com/Autodesk/revit-ifc/tree/master/Source/RevitIFCTools

PARAM     3c9ac775-15e4-4ba5-8edb-4167e3fb4151     IFC CAD Layer   TEXT  
PARAM     8df7e965-feaf-403f-8290-d4c289c99840      IfcDescription     TEXT    
PARAM     a3e2f9a7-f184-4d16-80e7-349181e17d3d      IfcExportAs     TEXT    
PARAM     9a17f9c0-c41b-4ceb-8279-b20e789fa3a8      IfcExportType     TEXT    

Parameter example...

I have also changed the icon layout for all nodes. All large icons are now 128x128 px, and I have started to use a green and yellow color in icons. Family document icons have got a new border to show they are only for Family documents. I am still trying to keep the general layout used by the Dynamo team.

This post is originally published at dynamobim.org

FamilyName

I have made some supplemental nodes for Element and ElementType to get FamilyName and Name for ElementType!



The new FamilyName nodes might come handy when it is needed to figure if a wall is a Curtain Wall or a Basic Wall :-)

This post is originally published at dynamobim.org

Shared Parameters

Yet another update (132.3.9 / 201.3.9)… new nodes created for Shared Parameters.

The idea with the “SetFile” node is to be able to set a temporary SP file while doing stuff, and in the end, return to the original SP file. If you want to test it without any “Stuff”, then use the Circut node, set it to false and then you can verify that the SP file changes. Then test it with the Circuit set to true and you should end up with the file you had in your file (remember to reset between the two tests!).

The two “query” nodes get all the parameters in the SP file and group them either by type or by group name.

This post is originally published at dynamobim.org

Subcategory nodes

more new nodes for getting families, familytypes, and nodes for subcategories.
-released in the 201.3.8 / 132.3.8 version of Orchid

This post is originally published at dynamobim.org

Orchid: new nodes

I have just updated to 132.3.7 / 201.3.7 versions. They both support the newly released 2.0.2 and 1.3.4 version of Dynamo as well.

One major change is that the two versions are now split into individual installers. I have evaluated that the time is up for this since the 2.0 version has been around for some time and that many new users don’t use the old 1.3 series anymore. However, there is still a world out there that need to be compatible with the 1.3 series. I will in the future develop against the 2.0 series but maintain the 1.3 series as long as it is possible without doing anything extra. Over time will the development of the 1.3 series stop.

By this version, I have also removed the last Custom Nodes meaning all nodes in the package is now Zero Touch nodes (The last four CN nodes for FEM-design).

This update also adds some new nodes and some updated nodes as well. Among these is the node there can tell the user if an update of the package exists!

new...
Does category/document contain?


Several nodes for materials


updated...
This post is originally published at dynamobim.org

Print nodes

I have made a new set of Print nodes, incl. a new node for the “ActiveView” that handles any kind of view incl. sheet view, which the OOTB node do not handle!



This post is originally published at dynamobim.org