Move title of a viewport

JeffStuy
Contributor
Contributor

Move title of a viewport

JeffStuy
Contributor
Contributor

After creating / placing a viewport, how do I position the viewport title

Reply
Accepted solutions (1)
15,229 Views
22 Replies
Replies (22)

Aaron.Lu
Autodesk
Autodesk
Dear Jeff,

Do you mean by moving the viewport title using API?


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes

Revitalizer
Advisor
Advisor

Dear Jeff,

 

ViewPort title is defined by its ElementType.

 

No text at all:

You can find the BuiltInParameter.VIEWPORT_ATTR_LABEL_TAG there.

Its value type is of ElementId.

 

To remove title from your ViewPort, just assign an ElementType which has a invalid id in this parameter.

If there is no such one, create one by duplicating an existing type and setting the parameter.

 

Text but hidden:

Also, there is a BuiltInParameter.VIEWPORT_ATTR_SHOW_LABEL of type integer.

Just use a type which has a value of 0 (or create one).

 

I think the second method is what you want since you just want to hide it.

Nonetheless, in both cases you need to search for an fitting ElementType or need to create one.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Revitalizer
Advisor
Advisor

Dear Jeff,

 

I misunderstood you.

You want to move the title, not hide it.

As said in my comment, the is a BuiltInParameter.VIEWPORT_ATTR_LABEL_TAG parameter in ViewPort's ElementType.

 

As you can see (if there is set a valid ElementId), the referenced Element is of BuiltInCategory.OST_ViewportLabel.

 

You need to edit the relating family to fit your needings.

In this case, you need to identify the text elements inside the family document and move them.

Since other ViewPorts may refer to this family, you should think about creating a copy before modifying the original one.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Anonymous
Not applicable
HI @ Revitalizer , I want to use API to move instance Label of viewport no need to edit family, in API has method ViewPort.GetLabelOutline, this method to get the Outline of Label of ViewPort, i think we must to have solution to set the Outline of Label, if not the method ViewPort.GetLabelOutline is no meaning.
P/s: i make a code to duplicate view and place duplicated view on new sheet with same location, everything is ok, just the location of label still not same location (because original label'location moved so duplicated viewport'label can not same).

Revitalizer
Advisor
Advisor

Hi hienngocloveyou,

 

ViewPort.GetLabelOutline is a Get but not a Set method.

Moving a Label means setting its Outline.

Which is not possible.

 

So if you have found another solution than editing the Family, let us know...

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Anonymous
Not applicable

Hi Jeff, all,

 

I had to do this (and had similar frustrations) when trying to automate sheet production via the API. I also found that, in 2014 at least, the viewport label doesn't tend to follow along when a parent viewport is moved after being instantiated. I tried several work arounds to get it to move with its parent viewport programmatically, but eventually gave up, and wrote a wrapper method that a.) hid the original viewport title, b.) instantiated a new text box heading family I *could* control, and c.) moved the two of them as a unit. The end result was easier to work with and gave me fine-grained control over the viewport's appearance. Not an ideal answer, I know, but a workaround if you find yourself in a pinch!

 

 

0 Likes

Anonymous
Not applicable

The problem is why autodesk make method GetLabelOutline, but don't have method for Set it, so method GetLabelOutline use what for ???

Anonymous
Not applicable
Is this error in the of not being able to set the viewport outline using the Revit API being resolved in the 2016 or 2017 API?
0 Likes

JeffStuy
Contributor
Contributor

Thanks all for you comments.  Honestly, except for the last post, I've not been notified that there have been any replies to my original post.  I applogize for not commenting sooner.

 

I too have not heard about any method that will allow the relocation of the viewport title.  I created a plugin that duplicates a sheet along with all of the viewports that can be duplicated.  I've been able to get the duplicated sheet to exactly match the original - except for the viewport title.  I'd really like to add this ability.  

 

Someone from AutoDesk visited our firm a while ago and was to look into this.  But, as is all to typlica of "marketing" guys - I've heard nothing.

 

In answer to the last post, I have only Revit 2014.  I do not know if this has been resloved with 2015 and above.

 

Jeff

JeffStuy
Contributor
Contributor

Arron,

 

 

I applogize for not responding sooner.  I did not get notified of your reply.

 

Yes.  Exactly.

 

 I created a plugin that duplicates a sheet along with all of the viewports that can be duplicated.  I've been able to get the duplicated sheet to exactly match the original - except for the viewport title.  I'd really like to add this ability.  It would make the plugin "complete."

 

Thanks,

Jeff

0 Likes

Aaron.Lu
Autodesk
Autodesk
Accepted solution
Hi Jeff, the function is not available in API, so a wish is logged for it:
CF-3707 - API ability to move label or title of viewport

thanks


Aaron Lu
Developer Technical Services
Autodesk Developer Network

PaulFrancoisStorm
Advocate
Advocate

This would be very helpful to me. I create:

  • per level
  • per discipline
  • per sheet
  • 4 views superimposed

If there are 52 levels the draftsmen have to do a lot of work to arrange the titles so they may annotate the views easily (see picture 1). Automation would be preferable. 

It does not seem the API exposes the location of the title (see picture 2).  

Anonymous
Not applicable

It's been 3 years since your post, has there been any movement on this?  I love how in Autodesk language "solved" means "you can't do it".

Anonymous
Not applicable

The Api not yet support this request. There is no way to solve that problem. We are waiting good new.

 

Hien.

Anonymous
Not applicable

Is there any update on this? Can we mass change the position / align all viewport tiltles ? There needs to be a way as it is tough to mange it in a project having more than 2000 sheets.

 

0 Likes

Anonymous
Not applicable

Look into Ideate Apps tool called Align.  It will get the job done pretty nicely:   https://ideatesoftware.com/ideateapps/align

As far as how they do it with the API, I haven't been able to figure out.  It will even align cropped views.  I think it does have trouble with split & squished views though which is understandable since it doesn't know where to line up.

0 Likes

Anonymous
Not applicable
Yes I would like this to be a method or property that can be set in the
Revit API. I will vote on this if it's in the wish list.
0 Likes

Anonymous
Not applicable

Its not clever but as work around you can;

  • Get viewport's view
  • Halve view's size in x direction to the right
  • Remove viewport and then replace, (title now at left of half size VP).
  • Reset size of view to original, title remain in place

It would be good if the API had a method.  Mine is a very "messy" workaround.

ahmadizm
Participant
Participant

Hey Tony,

 

What you suggested can be generalized in the following manner for drafting views and legends:

 

1-Get the desired location of label and line in the view's coordinate system. For this, you should consider the view scale and margins when the view is placed on a sheet.

2-Empty the view, and only create a temp line at the presumed location of the label line. 

3-Create the viewport; presumably, the label will be at the desired location* based on the default behavior of view placement in Revit.

4. Recreate the things that were removed in step 2, and get rid of that temporary line. The label will remain at its previous location.

 

* There is a catch: for certain viewport types, the api behavior can be different from when a user places a view on a sheet manually (surprise!). So even in this case, the outline will be closed to that of the desired label outline, but still a little different. To alleviate, you can go one step further between steps 3 and 4 above as follows:

3a-Obtain the label outline for the newly created viewport and by comparison to the desired outline, come up with a "correction" for temp line geometry (location and length), again, considering scales and margins.

3b-If the correction is significant:

3b-i- Remove the viewport, remove the temp line, create another temp line with the correction obtained in 3a.

3b-ii- Create another viewport - hopefully this time, the label will be at desired location, and you can proceed to step 4.

 

This sounds very messy as you suggested, but works as of Revit 2020.

 

Hope this helps.