Crop Rebar Shape Images

Crop Rebar Shape Images

miguel.gutierrezD74CZ
Advocate Advocate
492 Views
6 Replies
Message 1 of 7

Crop Rebar Shape Images

miguel.gutierrezD74CZ
Advocate
Advocate

Hi community, the FitToPage enumerate export images using to much white space. Is there any workaround to zoom a little bit more the image just like this:

miguelgutierrezD74CZ_1-1656975750777.png

so then Images can have a better visualization of those image in the rebar schedule.

 

 

			string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
			ImageExportOptions img = new ImageExportOptions();
			img.PixelSize = 1000;
			img.ImageResolution = ImageResolution.DPI_600;
			img.SetViewsAndSheets(new List<ElementId>{viewDetail.Id});
			img.ExportRange=ExportRange.SetOfViews;
			img.ZoomType = ZoomFitType.FitToPage;
			img.FitDirection = FitDirectionType.Vertical;
			img.HLRandWFViewsFileType=ImageFileType.PNG;
			img.FilePath = Path.Combine(desktopPath,"image1");
			img.ShadowViewsFileType = ImageFileType.PNG;
			detailComponent.ExportImage(img);
			#endregion

 

any recommendations tot the image name appropriately as I aimed t seo named the image as "image1" but it turns out to be "image1 - Floor Plan Ref Level"

Cheers

0 Likes
493 Views
6 Replies
Replies (6)
Message 2 of 7

Organon
Advisor
Advisor

@miguel.gutierrezD74CZ,

 

Hi,

 

What type of view are you using? I did something similar using a drafting view, and the zoom to fit works fine.

 

Regards,


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
0 Likes
Message 3 of 7

miguel.gutierrezD74CZ
Advocate
Advocate

The rebar shape reinforcement is generated on a detail component family so the data is visualized on a ref level plan

0 Likes
Message 4 of 7

Organon
Advisor
Advisor

But is it strictly necessary to do it in a plan view?

 

Regards,


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
0 Likes
Message 5 of 7

miguel.gutierrezD74CZ
Advocate
Advocate

Is not a must but It will ease the computation. I give it a try placing them on drafting view, however the zoom to fit option doesn't help that much as there is no way to control the height.

miguelgutierrezD74CZ_1-1657153012150.png

 

0 Likes
Message 6 of 7

jeremy_tammik
Alumni
Alumni

I just provided a suggestion in your other thread on indicating height and width pixels when exporting images:

 

https://forums.autodesk.com/t5/revit-api-forum/indicate-height-and-width-pixels-when-exporting-image...

 

I would suggest combining the approach of adding a known frame around the objet to display plus using a PNG trimming tool to remove the known frame and as much white space around it as possible. For instance, you can search GitHub for PNG trim:

    

https://github.com/search?q=png+trim

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 7

miguel.gutierrezD74CZ
Advocate
Advocate

Indeed, a trim PNG code is what I might be missing. Gonna look it up how it is done.

0 Likes