Drawing sheet issue

dharmeshchandnani
Participant
Participant

Drawing sheet issue

dharmeshchandnani
Participant
Participant

Hello All;

 

I am trying to create the drawing sheet and placing the views in drawing sheet

Starting with my problems:

1. I have to hide the levels which comes in Drawing sheet but unable to find where to do it using C#

dharmeshchandnani_0-1698389405057.png

I don't know the code for it but I will post below the code which I have done


2. The second problem is the visibility of Title block which I don't want to display

dharmeshchandnani_1-1698389481886.png

3. And the final problem is the position for placing the views
I have use location.U and location.V but it gives the view at extremen bottom rather then center

 

 

Below is my code , please guide me so that I can complete my work, I have used STANDARD Drawing template , I want to change the template but unable to do it

 

{

var block_type_name = "Standard";
foreach (var block_type in title_blocks)
{
var block_name = block_type.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_NAME).AsString();

if (block_name == block_type_name)
{
titleblock = block_type;
break;
}
}


var view_name = "{3D}";
Element view_1 = null;
foreach (var v in viewList)
{
var name_v = v.get_Parameter(BuiltInParameter.VIEW_NAME).AsString();
if (name_v == view_name)
{
view_1 = v;
}

if (view_1 != null )
{
var t = new Transaction(doc, "Add Views to Sheet");
t.Start();
var newsheet = ViewSheet.Create(doc, titleblock.Id);

UV location = new UV((newsheet.Outline.Max.U - newsheet.Outline.Min.U) / 2,
(newsheet.Outline.Max.V - newsheet.Outline.Min.V) / 2);
// Create viewports for both views on the sheet
Viewport vp1 = Viewport.Create(doc, newsheet.Id, view_1.Id, new XYZ(location.U,location.V, 0));

vp1.LookupParameter("View Scale").Set(500);
t.Commit();
}

 

 

 

 

please someone try to provide me the solution , it would be too helpful for me
Thankyou in Advance

0 Likes
Reply
162 Views
1 Reply
Reply (1)

longt61
Advocate
Advocate

1. The visibility of the bubble of levels as well as other datum elements in your view port must be hidden via the original view settings. You can not do it in the viewport. You can only use annotation crop to hide it by making sure the datum elements are completely outside of the annotation crop region rectangle, otherwise, the bubbles will still show.
You can hide the levels or other elements in the original view as follow:

            View view = Get_your_view();
            ElementId levelCatId = new ElementId(BuiltInCategory.OST_LevelHeads);
            view.SetCategoryHidden(levelCatId, true);

            // create a view port in the sheet here

 

2.  I believe what you mean is the viewport title, not the Title block. The Title block is the entire outer frame containing viewports when you create a new sheet with Project owner, issue date, etc..

To disable the view port title, you can either modify the type parameter of the current viewport type (not recommend) or you can switch to a type which does not show the title. By default, the "No Title" type should exist, otherwise, you can duplicate a new one and adjust the parameter to suits your need

view port type.png

the code for switching to new type:

 ElementType viewPortType = Get_your_view_port_type();
 viewPort.ChangeTypeId(viewPortType.Id);

 

3. You might want to check the Viewport class and utilize its methods. You can set its box center to your desired location as follow

viewPort.SetBoxCenter( your_new_location_in_XYZ);
0 Likes