Project Base Point at Startup Location?

revit
dynamo

#1

Hi all,

For a few months i have done a lot of reading on this forum, and already learned a lot.
So thanks to all contributors, for sharing their valuable time.
But now i a have a question, of witch i can’t seem to find the answer on this forum.
Is it possible to find out if the Project Base Point is at the Startup Location (or is moved)?

Thanks in advance,
Mark


#2

hello @MJB-online!

That can actually be done with one node!


#3

Hi Einar Raknes,

Thank you very much!
I’m going to play with this node one on some sample files.
If i receive a Third party file, i’d like to know in advance if someone messed with the basepoint :wink:.

Mark


#4

Hi Einar Raknes,

The above method works perfectly on the current projectfile :slight_smile:.

I know it’s a lot to ask, but could it also be done by a Python node on a directory of files.
I’m thinking of a workflow like the picture below. Instead of the Revit version the Python script should get the same info as the Coordinates.BasePoint node above.

Also many thanks to @T_Pover for providing the above python script, witch can be found here:
https://forum.dynamobim.com/t/get-revit-version-while-loading-family/10211/3?u=mjb-online

I hope someone can help me with this.

Mark


#5

So you’d want something like John Pierson’s Document.BackgroundOpen node from Rhythm package:

The Coordinates.BasePoint node only works on the current (active) document, but you could make a Python (or C#?) node to extract the coordinates from the project base point in a given document. This is the C# code for the built-in node:


Looks complex, but the work happens in just a few lines in GetBaseOrSurveyPoint.


#6

Hi David,

Thanks for your suggestion.
The Coordinates.BasePoint node does indeed only works on the current document, and that is why i would prefer a Python script that checks a list/directory of files.
Converting C# code to Python is beyond my knowledge :disappointed:, so i hope someone else can help me.

Mark


#7

This is a possible solution. It opens (and closes) the document(s) in a folder using Rhythm (@john_pierson ) nodes, and then I have applied the shown code. It gives you basepoint and survey point for the document(s).


RevitProjectPoints.dyn (9.8 KB)

import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript as AD
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#The inputs to this node will be stored as a list in the IN variables.
docs = IN[0]

def po(obj) :
	x = BuiltInParameter.BASEPOINT_EASTWEST_PARAM
	y = BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM
	z = BuiltInParameter.BASEPOINT_ELEVATION_PARAM
	pointX = obj.get_Parameter(x).AsDouble()
	pointY = obj.get_Parameter(y).AsDouble()
	pointZ = obj.get_Parameter(z).AsDouble()
	return AD.Geometry.Point.ByCoordinates(pointX, pointY, pointZ)

result = []
for doc in docs :
	TransactionManager.Instance.EnsureInTransaction(doc)
	try :
		pbp = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectBasePoint).ToElements()
		sbp = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_SharedBasePoint).ToElements()
		result.append(doc.Title)
#		result.append(doc.PathName)
		result.append(po(pbp[0]))
		result.append(po(sbp[0]))
	except :
		result = False
	TransactionManager.Instance.ForceCloseTransaction()

#Assign your output to the OUT variable.
OUT = result, docs

First attempt Editing a Python script
Get project base point detail from closed project files
PBP / SP Value via Background Open
#8

Hi Erik,

Thank you very much.
I can’t test the above code at this moment, but i am very sure it is the solution for my problem.

With kind regards,
Mark


#9

Hi MJB,

This is possibly a silly question but are ‘Application.OpenDocumentFile’ and ‘Document.BackgroundOpen’ functionally the same?

Seems ‘Document.BackgroundOpen’ has been replaced by ‘Application.OpenDocumentFile’?

Thanks


#10

Hi @jaclyn.s,

I think you’re right.
Document.BackgroundOpen and Document.Close are the old versions (Python code).
And Application.OpenDocumentFile and Application.CloseDocument are new versions (C# code for better performance). But to be sure maybe @john_pierson can shed a light on this :grinning:.

Kind regards,
Mark


#11

Yep, those are the new ones! :slight_smile: