[V8i MVBA] Extrude Profile to Solid

I'm testing Extrude to solid method as follows:

Sub TestExtrude()

Dim oEle As Element 
'Dim oSmartSolid As SmartSolid
Dim oSmartSolidEle As SmartSolidElement Set oEle = ActiveModelReference.GetElementByID(DLongFromString("62494")) 'This is not necessary as Jan pointed out below 'Set oSmartSolid = SmartSolid If oEle.IsPlanarElement Then ' Set oSmartSolidEle = oSmartSolid.ExtrudeClosedPlanarCurve(oEle, 100, 0, True) Set oSmartSolidEle = SmartSolid.ExtrudeClosedPlanarCurve(oEle, 100, 0, True) End If ActiveModelReference.AddElement oSmartSolidEle oSmartSolidEle.Redraw End Sub

The problems are

1. what I got is different from what I manually extruded by using command "Solid by Extrusion". See pic below, the left one is what I extruded manually, the right one is by code. the manual one is solid, the code one is smartsolid; the manual one is just one element, the code one is two elements, the original profile and the extruded smartsolid;

2. The method syntax is

Syntax

Set SmartSolidElement = object.ExtrudeClosedPlanarCurve (planarClosedElement, forwardDist, backwardDist [, capSurface])

But even I changed the forwardDis or/backwardDis, but there is no difference with extrusion direction, in this case, always downward.

Questions:

1. How can I make the code one as the same as the manual one?

2. How to control the extrude direction?

 

Any replies appreciated. Thanks.

Parents
  • Hi Wence,

    few comments:

    • It would be nice to reinsert your code using Syntaxhighlighter (yellow pencil icon), so it will be nicely formated and consequently easier to read.
    • There is no need to use Set oSmartSolid = SmartSolid, you can use SmartSolid directly, it's always existing object.

    Unknown said:
    1. How can I make the code one as the same as the manual one?

    Often there is no direct reference between user tools and methods available in API in terms of their behaviour. In my opinion there are two separate issues there:

    • Orifinal profile left: The tool Solid by Extrusion contains Keep original switch, which deletes the original profile when the extrusion is finished. ExtrudeClosedPlanarCurve method does extrusion only, so it's up to you to delete the original element if you don't need it.
    • Solid vs. SmartSolid: Solid by Extrusion creates solid, ExtrudeClosedPlanarCurve creates SmartSolid. There is no Solid API available in MicroStation VBA, so you should find another way how to convert SmartSolid to Solid (I don't know, can it be done somehow in MicroStation?).

    Unknown said:
    2. How to control the extrude direction?

    Frankly, I am also not sure how forwardDist and backwardDist should work, but working solution is to use forwardDist only with positive values, which means identical with a profile normal direction, and negative values, which extrudes the profile in an oposite direction.

    With regards,

      Jan

  • Thanks Jan, I've reinserted the code using Syntaxhighlighter.

    You're right, if I use negative values in forwardDist, the extrude direction changed.
    Solid vs. SmartSolid: the problem is they display differently even in the same display style, as you can see in my pic, the one by code looks transparent... And as you said, it seems no method to convert smartsolid to solid.
  • Unknown said:
    I've reinserted the code using Syntaxhighlighter.

    Great, it looks much better now! ;-)

    Unknown said:
    Solid vs. SmartSolid: the problem is they display differently even in the same display style

    I have not dived into the differences between solids and smart solids, but because they are different element types represented in a different way internally, I assume they can be also displayed differently. But I don't think this is the case ...

    Unknown said:
    as you can see in my pic, the one by code looks transparent

    ... because I tested it with my MicroStation V8i (SELECTseries 3) Update 2 and both manually created solid and smart solid created by VBA code are displayed in the same way. So the problem is probably somewhere else, not the objects are different types.

    Unknown said:
    And as you said, it seems no method to convert smartsolid to solid.

    Fortunately it will be solved in MicroStation CONNECT Edition, because a new internal representation of 3D objects is used and the "solid vs smart solid schizofrenia" will be the past.

    With regards,

      Jan

  • Thanks again Jan. My SS3 is 08.11.09.536.

    I tested again, extrude a circle, but same result.

Reply Children