[AECOSim Building Designer V8i - VBA] - "Place Wall"

Is it possible to place a wall by a vba-macro?

Something like...
       Set MyLine = Application.CreateLineElement2(Nothing,StartPoint, EndPoint)
       Application.ActiveModelReference.AddElement My Line
...not for LineElements but for Walls.

Thank you very much for helping me.

Parents
  • After you reference TFCom and STFCom, you can place a wall by using VBA code. The following is a C# code and VBA code is very similar. you can refer to it.

    Application msApp = Bentley.MicroStation.InteropServices.Utilities.ComApp;   // defined in Bentley.MicroStation.dll
    
    STFWallList wallList = new STFWallList();
    STFWall wall = wallList.AsSTFWall;
    
    TFFormRecipeLinearList formList = new TFFormRecipeLinearList();
    TFFormRecipeLinear linearForm = formList.AsTFFormRecipeLinear;
    Point3d p = msApp.Point3dFromXYZ(50, 0, 0);
    Point3d q = msApp.Point3dFromXYZ(50, 20, 0);
    linearForm.SetEndPoints2(ref p, ref q);
    linearForm.SetThickness(0.5);
    linearForm.SetOffsetType(TFdFormRecipeOffsetType.tfdFormRecipeOffsetTypeCenter);
    linearForm.SetTopFixedHeight(5.0);
    wall.SetTFFormRecipeList((_TFFormRecipeList)formList);
    
    wall.InitNamedProperties("Wall", "Concrete");
    _TFFormRecipeList recipeList = wall.GetTFFormRecipeList();
    TFFormRecipe recipe = recipeList.AsTFFormRecipe;
    recipe.SetPartFamilyName("WallComponent");
    recipe.SetPartName("Concrete");
    
    wall.AddToDgn();

    HTH, YongAn



  • Thanks a lot for your answer YongAn.

    I am a vba beginner without c# experience so it would be really kind of you to check my vba code.

    Sub Main()

    Dim wallList As STFWallList
    Dim wall As STFWall
    Dim formList As TFFormRecipeLinearList
    Dim linearform As TFFormRecipeLinear
    Dim p As Point3d
    Dim q As Point3d
    Dim recipeList As TFFormRecipeList
    Dim recipe As TFFormRecipe

    Set wall = wallList.AsSTFWall
    Set linearform = formList.AsTFFormRecipeLinear

    p.X = 50 / p.Y = 0 / p.Z = 0
    q.X = 50 / q.Y = 20 / q.Z = 0

    linearform.SetEndPoints2 p, q
    linearform.SetThickness 0.5
    linearform.SetOffsetType TFdFormRecipeOffsetType.tfdFormRecipeOffsetTypeCenter
    linearform.SetTopFixedHeight 5#

    wall.SetTFFormRecipeList formList
    wall.InitNamedProperties "Wall", "Concrete"


    Set recipeList = wall.GetTFFormRecipeList
    Set recipe = recipeList.AsTFFormRecipe

    recipe.SetPartFamilyName "WallComponent"
    recipe.SetPartName "Concrete"

    wall.AddToDgn

    End Sub

  • Dear YongAn:

    How could I refer the TFCom and STFCom? It's no way to refer .
  • Hello Chih bo yu,
    If you are using C#, you should reference Bentley.Interop.TFCom.dll which is under folder C:\Program Files (x86)\Bentley\AECOsimBuildingDesigner V8i Ss6\AECOsimBuildingDesigner\assemblies.
    HTH,
    YongAn



  • Unknown said:
    How could I refer the TFCom and STFCom?

    If you're writing VBA, then use the Tools|References menu in the VBA editor to pop the VBA References dialog.  Then you can add the VBA libraries to your VBA project...

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data