Something for the BIM with everything

Long story short – the assignment we got was to create an electrical schematic drawing programmatically.

Warning: Work in Progress, stay tuned for updates.

So – in AutoCAD the schematic looked like this:

Noname

First step – rebuild it in Revit using Generic Annotations and then record the position of each element:

Noname

So, rebuilt in Revit (there is still the import instance visible in yellow)

Next step – a Dynamo script to record family type name and location into Excel:

Capture.png

Next step – create a new drafting view, read the Excel sheet and position the families:

Capture.png

Graph above and the result:

Noname

Getting there – as said work in progress..

Some more detail – recording the positions was fairly trivial, the Dynamo is here.

Recreating the 2D assembly in a drafting view was a bit more complex – Dynamo here.

Some Python script required (originally: #Copyright(c) 2016, Dimitar Venkov):

Code below:

import clr

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference(“RevitAPI”)
import Autodesk

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

def tolist(obj1):
    if hasattr(obj1,”__iter__”): return obj1
    else: return [obj1]

view = UnwrapElement(tolist(IN[0]))
ftype = UnwrapElement(tolist(IN[1]))
fpts = UnwrapElement(tolist(IN[2]))

OUT = []
ftp_len = len(ftype) == 1
view_len = len(view) == 1

TransactionManager.Instance.EnsureInTransaction(doc)
for i in xrange(len(fpts) ):
    p = fpts[i].ToXyz(True)
    j = 0 if ftp_len else i
    k = 0 if view_len else i
    try:
        if not ftype[j].IsActive : ftype[j].Activate()
        nf = doc.Create.NewFamilyInstance(p, ftype[j], view[k])
        OUT.append(nf.ToDSType(False) )
    except:
        OUT.append(None)
TransactionManager.Instance.TransactionTaskDone()

To-do:

Analyse a model like this:

Noname

Record the elements found and fetch the right symbol families to get placed in a drafting view…

In the end – a real world example where we are aiming at:

Noname.png

Lots to do… stay tuned

And life is good again…

 

 

 

 

Advertisements

One thought on “Something for the BIM with everything

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s