Duplicate Views & Assign Scope boxes

Hi All,

This is what I’m trying to accomplish

I have a set of views (say, 4 views as dependents). I need to create 2 sets of the same (in the same manner) so I can use them for showing different set of info (FRP Plan, finishes plan etc)

I saw Clockwork can duplicate the View as a Dependent directly - Thanks a lot Andreas

But is there a way to duplicate it by x times? Think it should be easy - I am missing something there… Can someone help?

Also, is there a way to assign a scope box as the amount for a View crop?

Please suggest more efficient ways of duplicating views - think it’s a pain to duplicate it one by one & assign a named scopebox one by one!!

 

Thanks!

Hi Chandarsekar,

The “List.OfRepeatedItems” node should prove helpful in your case:

2015-02-12_160712

Great help - Thanks a lot, Dimitar

That should do the required - opens up many options if this can be done so easily

Is there a way to assign / control the type of view that is being duplicated? Can you please show me how to get there?

 

Thanks!!

Controlling the view type would be as easy as selecting a different host view from the views node.

Hi Dimitar,

Think I was not that clear with what I had in mind

Like explained earlier, let’s say I am trying to create a set of FRP Plans

So the duplicated view should belong to another “type” of Floor plan called, like FRP Plans

I was hoping it would be achievable using Element.SetParameterByName itself… but couldn’t crack it till now

Maybe I should use Lunchbox package also - will experiment & post a graph

 

Thanks a lot!!

OK - This is where I reached, Thanks again to Dimitar for showing me the “List.OfRepeatedItems” Node.

But there are some issues & I can’t quite explain what’s happening - Need someone to throw more light on this… I have attached the DYN file for your opinion…

  1. When I use the definition for the 1st time, it appears to be fine but on subsequent runs, it replaces the views created earlier, instead of adding the new views…

2015-02-23_01

2015-02-23_02

 

 

 

 

 

 

 

  1. Guess it is renaming the existing views instead of creating new views - so I face the “same name” error some times…

2015-02-23_03

2015-02-23_04

 

 

 

 

 

 

Can any of you suggest a better way to achieve the same result?

Also, is there a way of to set more than one parameter using one “Element.SetParameterByName” node? Is there a way to control or set the Type Parameters of the Views created?

Duplicating as Dependents

Thanks

R. Chandrasekar.

Hi, I have also been playing around with the view and sheet functions but with a different work flow.

For MEP projects we need to make loads of different views f0r each system and level, so my approach is;

Select all levels -> Make view per level -> Select View Template -> Apply to all Views -> Name (And Number) views by Template, Level, Discipline. Then after making all the levels for the chosen template I want to; Get Sheet Name/Number from Views (The name I just gave them)-> Sheet by Name Number Title and Views -> Select Sheets and set descriptions etc based on View properties. So repeating this for different View Templates will create the main floor plans on sheets for all disciplines.

(Chandrasekar, the reason the views just get replaced by multiple runs is because dynamo always does this with changes in revit. You need to exit and then re-open dynamo and run again. Or do stuff with revit transactions… I also had problems with duplicate sheets, so I put an X at the end of all new sheet numbers, then made a simple dynamo script to remove the X once they are correct.)

The problems I ran into (Or possible things to improve :stuck_out_tongue: ) were;

-Floor Plan View by Level would be a lot more useful if it was by Level(s) so it could be fed with a list of all the levels in a project. Currently this method requires selecting each level to make one view then combining them in a list, so the graph needs to be modified for different projects with different numbers of levels.

-As above, No easy way to set Scope Box. Setting parameter by name and a string gives an error (parameter is not a string) and feeding it an actual scope box selected by ID doesnt work either. What kind of input would this need to be? This is important to crop the view by a pre-defined area that fits on the sheet. View naming could also be done by scope box for different areas of a building. Maybe make a mass and crop by extents?

-The dreaded Default Underlay… Even new views created by Dynamo have the floor below on as Underlay. The most retarded default setting in Revit and no way to globaly change it or schedule it… A node to take care of this issue would be great. I found some API stuff about it but havent got that far yet.

  • Sheets by Name Number Titleblock and Views alsmost always fails and says it cant pack the views on the sheet, unless you select a really huge title block. Also when it does work the view isnt even within the border of the title block, so how it determines if the view fits or not is a bit strange. I think it would be much more useful to split this node into “Sheets by Name Number and Title” to make empty sheets and then “Place View on Sheet” with a View input and X,Y coords relative to the title block origin. Then users can deliberately put views that are too big on the sheet (Often the case, as rotated scope boxes show much larger extents than the cropped viewport) or put multiple views on a sheet with coords calculated from the Scale, Format, etc. (Or just by some repeated tweaking of sliders to get it right).

I really think View and Sheet management is an important “normal” use for Dynamo as, even with these limitations, it saves so much tedious work.

Heres what I have managed to get working so far View to sheet packer Views by Template

Is there a way to get and change the position of a view on a sheet?

yes!

but you will need some python!

this is just a reference not a real node, basically my code was for creating a sheet and placing a view on the sheet.

for retrieveing view geometry:

Viewport.GetBoxCenter will return the center of the viewport on the sheet

Viewport.SetBoxCenter(XYZ) will move former center to new center

 


view1=UnwrapElement(IN[1][0]) # this is the view
view1box=view1.get_BoundingBox(doc.ActiveView) # get the bounding box of the view you can use BoundingBox.Min and BoundingBox.Max to determine length and height of the view

TransactionManager.Instance.EnsureInTransaction(doc) # you need an active transaction as you will create elements
viewsheet = ViewSheet.Create(doc,fs.Id) # create a new sheet where fs.Id is the id of the titleblock
viewsheet.Name="Name of sheet"
viewsheet.SheetNumber=“number of sheet”

location = UV((viewsheet.Outline.Max.U-viewsheet.Outline.Min.U)/2,(viewsheet.Outline.Max.V-viewsheet.Outline.Min.V)/2) # that is the middle of the sheet

Viewport.Create(doc,viewsheet.Id,view1.Id,XYZ(location.U+3.048,location.V,0))

 

hope that helps

Thanks Peter I will give it a try

Made some progress with this and managed to split it into two separate python nodes (the creation of an empty sheet with title block, and the placement of a single view onto the sheet with XY coords).

However my lack of python knowledge is letting me down when it comes to making a version that will process lists of multiple sheet names and numbers.

The code is here http://pastebin.com/DC8w4Ff0 and gives the error; File"<string>", line 30, in <module> TypeError: expected index value, got str But I cant see where I am going wrong or why “number” would be a string…

maybe its just friday.

Try changing line 28 to:

for number in range(len(sheetnumbers)):

Thanks that fixed it :slight_smile: I wrongly assumed it would use the length of the list anyway, doh.

Python is very slowly starting to make sense though, seems like a nice language to use.

How to place views on sheet without Sheets by Name Number and Title node in dynamo, this node has problem when place structural view and schedule view.

I think we use dynamo but, i have problem with this code:

viewsheet = ViewSheet.Create(doc,fs.Id) # create a new sheet where fs.Id is the id of the titleblock <== i get ID of tittleblock and put it in code, but code error

Someone can help me place view on sheet with the python code, thanks

This is my dynamo file, and it has problem with structural view and schadule view.

Select view on sheet

 

See my example above.

You dont need to use the ID of the title block as an input, just the titleblock Family itself. So “titleblock=Unwrapelement[2]” defines the second input in dynamo as the titleblock, “titleblock.Id” gets the ID of this family. (Or fs.id in the original. I changed the names to make it clearer what everything is as I am also a python noob).

thanks for you reply, i’ll test it this day. Maybe need more your help :slight_smile:

@Peter Kompolschek and @Joseph Peel . I have a problem when i want to get BoundingBox of these View, it has no attribute “Max” for them ???

Maybe i has mistake somewhere ?? Please give me a advise !!

 

3 4

If you need to filter the scope boxes you can do something like this: