【MSTN】【C#】【V8i】Extract cellelement based on the shape of an element

I drew a CellElement, as shown in the figure,

I want to turn it into another shape. This shape is an element created by the CreateShapeElement1 method in the VBA document.

Is there any way to realize it, any suggestions would be grateful?

  • Hello Alisa, 

    I am not sure what your problem is in detail. 

    C# in V8 is just a cover to VBA, so you could use every function from VBA. Or are you asking how to build a standard modification function (locate - > read - > modify|replace - > rewrite)? 

    Mit freundlichen Grüßen / Best regards
    Volker Hüfner

    |  AB_DATE Engineering  Software   |  ab-date.de  |

  • Hi Alisa,

    I agree with Volker that it's not clear what your are asking about. In the fisrt sentence you mentioned CellElement, but in second one you use "shape". Also the pictures seem to be completely different: First one is quite complex, second is just one element (shape?).

    If you need to change existing cell, the most simple way is to create a new one with new parameters. This approach has some disadvantages (e.g. existing elements are deleted and new element have new element id), which can be problem sometimes.

    With regards,

      Jan

  • Hi ,

    As Jan and Volker mention, "the end goal" may not be apparent.  Given picture 1 and 2, I presume you may want to "Pattern" or "Hatch" the 2nd shape shown with the 1st cell. If this is the case, maybe this will help.

    1. Open (or create a desktop short cut to) your MicroStation\MicroStationVBA.chm VBA help file.
    2. Click on the Search tab and type: e.g. *pattern*
    3. Not help topics listed:
      1. SetPattern
      2. AreasPattern

    NOTE: You can use search for any search term using: a.) wildcards (e.g. *needtofindsomething*), b.) quotes (e.g. "need to find something", and c.) boolean operators: AND, OR, NEAR, and NOT (e.g. Need AND to AND find AND something)

    I think the code snip provided in the "SetPattern" help topic may help if you are asking how to pattern an element using a pattern cell.

    HTH,
    Bob



  • Thanks for your answer, I should not describe my problem clearly. I would like to ask if the MTAN VBA method provides an interface to the method in the figure.

    I want to use this method to achieve my purpose,

    but I didn't find it in VBA.

    Looking forward to your answer

  • Hi Alisa,

    I would like to ask if the MTAN VBA

    What is MTAN VBA? Do you mean MicroStation? Usually MStn abbreviation is used, nothing else.

    VBA method provides an interface to the method in the figure.

    It seems you are asking about something completely different than originally. I do not see any link between 3D Boolean tools you ask about now and patterned cells shared in the past. But anyway..

    I want to use this method to achieve my purpose,

    VBA provides API to MicroStation kernel, not to MicroStation tools (that are implemented using the same API as MicroStation publishes externally). So when you want use tools, you usually have to work with them through key-ins.

    You do not specify what MicroStation version do you use. Please read and follow best practices and specify the used version. VBA has provided only limited 3D API and it has changed in different V8i version. Because you mentioned V8i without any specification and there are many versions of V8i, it's not possible to guess whether your version provides at least some 3D API (e.g. V8i SS3 / SS4 / SS10) or not (original V8i versions).

    BTW Please follow best practices also how subject should be formatted. To use not standard format [<product> <version> <language>] but separate different style brackets maybe looks interesting, but does not offer any benefit like better readability.

    Looking forward to your answer

    Specify what MicroStation version do you use.

    Check your MicroStation VBA documentation for SmartSolid object and related methods. I see methods like SolidIntersect, SolidSubtract and SolidUnion in V8i SS4 VBA API.

    When the methods provide not enough functionality, you can call MDL functions through P/Invoke from C# or for more complex code, you can you C++/CLI as a bridge between native C/C++ API and managed world.

    With regards,

      Jan

    Answer Verified By: Alisa LI 

  • you can call MDL functions through P/Invoice

    P/Invoice?  Must be Microsoft's new billing method.  There must be a P/GiveMeYourCreditCardDetails to complement that.

     
    Regards, Jon Summers
    LA Solutions

  • Hmmm ... it looks like I slept still when I wrote the answer ;-) The type is corrected now.

    Regards,

      Jan

  • I drew a CellElement
    I want to turn it into another shape

    As others have commented, your goal is not clear.  Nobody understands what you want to achieve.  However, we all use MicroStation.

    Why not post a DGN file that includes example models?  Show us...

    • The geometry that you start with
    • The objects you want to finish with

     
    Regards, Jon Summers
    LA Solutions

  • Hi Alisa,

    Your post and reply appear to be asking about (2) different types of issues. Here are a couple things that may help:

    1. If someone provides a "Suggested Answer" and the information allowed you to close or resolve the problem, please use the More (button) > Verify Answer.  Please note there can be more than one response that was helpful and you can have multiple verified Answers, though Ideally 1 (best) Answer is preferred most of the time.
    2. If you have a New issue/question for a different type of issue, then please create a new post to help keep each issue separate and helping to establish and resolve each more quickly.
    3. NOTE: Information on both #1 and #2 above and more help can be found in the Communities Best Practices

    As you may be new and learning MicroStation APIs in V8 using C#, we have found it best to perform as much coding directly in VBA (to be loaded and run) using MicroStation Key-ins from C#/.NET wherever possible.  Doing so makes it much easier to isolate and test issue if/when they go wrong; easier to debug and improved performance.

    With the Bentley Communities you may also want to leverage using the fairly powerful Communities search features.  This can help you explore e.g. (different words of interest - search terms) and see if someone else has asked and possibly resolved each issue w/o having to create a new post/question.  So, for instance this may be how I would try to find information based on your most recent question and search for: e.g. VBA AND intersect AND solid.

    HTH,
    Bob



    Answer Verified By: Alisa LI