View is not created in "Sheet.ByNameNumberTitleBlockAndView"

Hi there,

I am trying to use the very basic command: Sheet.ByNameNumberTitleBlockAndView

From some reason, it does create a sheet but doesn’t place the view on it.
any suggestion of what am I doing wrong?

thank you, thank you…

What does the results window show for the Sheet node?

It shows this:

image

the only view I manage to placeis the “Landing view”, which is a drafting view

This node doesn’t work for me either. Ever.

@solamour does dynamo team know’s this node not working properly?

@no-am I’ve split my actions into to 2 scripts. First make sheets with this node. It won’t place the views. Then place the views with this python script. Benefit is also that you can control placement of the view. It won’t be placed randomly on the sheet.

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

def U(elem): 
	a = UnwrapElement(elem)
	return a

vi = U(IN[0]).Id
sh = U(IN[1]).Id
xx = IN[2]/304.8
yy = IN[3]/304.8

viewports = []

TransactionManager.Instance.EnsureInTransaction(doc)

viewport = Viewport.Create(doc, sh, vi, XYZ(xx, yy, 0))

TransactionManager.Instance.TransactionTaskDone()

viewports.append(viewport)
	
OUT = viewports

first of all thaks a lot!! I realy appreciete it.

I still get the same result though. it doesn’t place any view on the sheet.
and I get this error: “Exception: viewId cannot be added to the ViewSheet.”
Actually I have tried to use the Rhythm package node “ViewPort.Create” and got the same error.

Any ideas??

Hi,
Try change to your Sheet Number value Input.

I think the error occurs because you do it in the same transaction. Maybe Transaction.End node between output of sheet and input of python script will help.

@ngochungwru…I didn’t quite get what you are doing there…
Did you mean I need to change the Sheet name to a string?
and what is the “Tool.GetRevitSelection” node that you’r using?

same old error:

Hi @no-am,
I have got same error like you but when I changed Sheet Number to another value, its worked. Maybe the node “remember” value before.
The node “Tool.GetRevitSelection” only get Views from Revit by selection, you can use other method to get Views.

Try the following. Freeze the python script node and run the script so the sheet is created. Then unfreeze and run again. Let know if it worked.

You also need the Transaction.Start node after the End node to regenerate the items made in Revit. Sometimes it can also be due to the crop size of the view not fitting on the sheet extents.

Oh. I see. I’ve changed the number and even put a new “Sheet.ByNameNumber…View” to clear the node’s “memory” but still the same result.
is “Tool.GetRevitSelection” part of a package or a native dynamo node?

Still doesn’t work.

I think the problem somehow has to do with the view that coming out of “All Elements of Category”.
for 2 reasons.
first, because the error is referring to the “ViewID” that can’t be added.
and secondly, when I’ve tried to create the view with Dynamo initially and not using an existing referred view from the document evethough it didn’t fit the sheet extents (@SeanP )…

Lets experiment. Create the sheet you need with just the node Sheet.ByNameNumberTitleBlockAndView Then in a new script try to place the view you want on the sheet you made with my python script. Tell what your results are.

I like this hand by hand solution :slight_smile:

but… :frowning:

Gonna ask just to make sure, but I assume that view isn’t already on another sheet right?

well that’s a head scratcher… :face_with_monocle:

@SeanP good question. @no-am is it?

Ok, guys. It is a bit embarrassing but this is the case…:shushing_face:
I was so enthusiastic to place this view didn’t notice it is placed on an abandoned sheet somewhere hidden…

I really really appreciate your help. and @fluffyhugger your great code. it is my first post to the Forum (I am a grasshopper user) and you guys proved it worth the effort.

Thanks again

Nice. Would you select solution, so that the topic can be closed.

1 Like