Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 383

Set Element Transparency ( Microstation V8i Using C# .Net Language)

$
0
0

Hi Guys,

Requirement : Scan all shape elements(polygons) in active dgn and then make them fill and set transparency.(Fill mode on off)

buy using below code i am giving 30 percentage transparency ( txt_trans_per.Text ) but it is applying with 100 percent.

please let me know where i am doing mistake .

BIM.Application mstnApp = BMI.Utilities.ComApp;
BIM.ElementScanCriteria esc = new BIM.ElementScanCriteriaClass();
esc.IncludeOnlyVisible();
esc.ExcludeAllTypes();
esc.IncludeType(BIM.MsdElementType.Shape);
BIM.ElementEnumerator ee = mstnApp.ActiveModelReference.Scan(esc);
            
if (BtClick == false)
{
         while (ee.MoveNext())
          {
                    BIM.Element Elm = ee.Current;
                    Elm.AsShapeElement().FillMode = BIM.MsdFillMode.Filled;
                    Elm.Transparency = Convert.ToInt32(txt_trans_per.Text);
                    mstnApp.ActiveModelReference.ReplaceElement(Elm,Elm);
           }

           BtClick = true;
           Bt_FillMode.Text = "Polygon Fill Mode : OFF";

}

else
 {
                while (ee.MoveNext())
                {
                    BIM.Element Elm = ee.Current;
                    Elm.AsShapeElement().FillMode = BIM.MsdFillMode.NotFilled;
                    Elm.Transparency = 0;
                    mstnApp.ActiveModelReference.ReplaceElement(Elm, Elm);
                }
                BtClick = false;
                Bt_FillMode.Text = "Polygon Fill Mode : ON";
}


Viewing all articles
Browse latest Browse all 383


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>