CreateArcElement3

I want to create Arc cell using CreateArcElement3.

For example I want to make a circle cell using CreateArcElement3.

 

 

 

Parents
  • itotakayuki:

    I want to create Arc cell using CreateArcElement3.

    For example I want to make a circle cell using CreateArcElement3.

    You mention three different element types in your question.  Which do you want to create?

    1. an arc
    2. a circle
    3. a cell

    In MicroStation, a circle is a special case of an ellipse. To create a circle, use one of the CreateEllipseElement methods.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Mr. Jon 

    Thank you for your responce always.

    I want to put two half circles each other like a coil symbol and make a cell.

    Regards,

    Takayuki Ito

     

     

  • itotakayuki:

    I want to put two half circles each other like a coil symbol and make a cell.

    1. Make arc1 using CreateArcElement3
    2. Make arc2 using CreateArcElement3
    3. Add those to an array of Elements
    4. Use the array of Elements with CreateCellElement1
    5. Add the new CellElement to your DGN model

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Mr. John. 

    I tried what you said, but I failed.

    Below is the drawing I created. But Arc is not cell.

    Best regards,

    Takayuki Ito

     

    >>>>>>>>>>>>>>>>>>>>
    Dim linepoints(0 To 1) As Point3d
    Dim linepoint(0 To 1) As Point3d
    Dim Diam As Double
    Dim myline As LineElement
    Dim length As Double
    Dim I As Integer
    Dim Wendpoint(0 To 4) As Point3d
    Dim Cenpt(0 To 3) As Point3d
    Dim myarc(0 To 4) As ArcElement


    Diam = 0.01
    length = 0.04

    linepoints(0).x = 0: linepoints(0).y = 0
    linepoints(1).x = linepoints(0).x + length: linepoints(1).y = linepoints(0).y


    Set myline = CreateLineElement1(Nothing, linepoints)

    myline.Color = 3
    ActiveModelReference.AddElement myline
    myline.Redraw

    ' Arc
    'End point
    For I = 0 To 4
    Wendpoint(I).x = linepoints(1).x - 0.5 * Diam
    Wendpoint(I).y = linepoints(1).y + 0.5 * Diam + Diam - I * Diam
    Wendpoint(I).Z = 0
    Next


    For I = 0 To 2
    Cenpt(I).x = linepoints(1).x - 0.5 * Diam
    Cenpt(I).y = linepoints(1).y + 0.5 * Diam + Diam - I * Diam - 0.5 * Diam
    Cenpt(I).Z = 0

    Set myarc(I) = Application.CreateArcElement1(Nothing, Wendpoint(I), Cenpt(I), Wendpoint(I + 1))
    myarc(I).Color = 20


    ActiveModelReference.AddElement myarc(I)

    myarc(I).Redraw
    Next


    linepoint(0).x = linepoints(1).x + 0.01732: linepoint(0).y = linepoints(0).y
    linepoint(1).x = linepoint(0).x + length: linepoint(1).y = linepoints(0).y

    Set myline = CreateLineElement1(Nothing, linepoint)

    myline.Color = 3
    ActiveModelReference.AddElement myline
    myline.Redraw


    For I = 0 To 2
    Wendpoint(I).x = linepoint(0).x
    Wendpoint(I).y = linepoint(0).y + Diam - I * Diam
    Wendpoint(I).Z = 0
    Next

    'Adjust center point for draw
    For I = 0 To 1
    Cenpt(I).x = linepoint(0).x - 0.5 * Diam
    Cenpt(I).y = linepoint(0).y + 0.5 * Diam - I * Diam
    Cenpt(I).Z = 0

    Set myarc(I) = Application.CreateArcElement3(Nothing, Wendpoint(I), Cenpt(I), Wendpoint(I + 1))
    myarc(I).Color = 20

    ActiveModelReference.AddElement myarc(I)

    myarc(I).Redraw
    Next

    End Sub

     

  • Mr. John. 

    I tried what you said, but I failed.

    Below is the drawing I created. But Arc is not cell.

    Best regards,

    Takayuki Ito

     

    >>>>>>>>>>>>>>>>>>>>
    Dim linepoints(0 To 1) As Point3d
    Dim linepoint(0 To 1) As Point3d
    Dim Diam As Double
    Dim myline As LineElement
    Dim length As Double
    Dim I As Integer
    Dim Wendpoint(0 To 4) As Point3d
    Dim Cenpt(0 To 3) As Point3d
    Dim myarc(0 To 4) As ArcElement


    Diam = 0.01
    length = 0.04

    linepoints(0).x = 0: linepoints(0).y = 0
    linepoints(1).x = linepoints(0).x + length: linepoints(1).y = linepoints(0).y


    Set myline = CreateLineElement1(Nothing, linepoints)

    myline.Color = 3
    ActiveModelReference.AddElement myline
    myline.Redraw

    ' Arc
    'End point
    For I = 0 To 4
    Wendpoint(I).x = linepoints(1).x - 0.5 * Diam
    Wendpoint(I).y = linepoints(1).y + 0.5 * Diam + Diam - I * Diam
    Wendpoint(I).Z = 0
    Next


    For I = 0 To 2
    Cenpt(I).x = linepoints(1).x - 0.5 * Diam
    Cenpt(I).y = linepoints(1).y + 0.5 * Diam + Diam - I * Diam - 0.5 * Diam
    Cenpt(I).Z = 0

    Set myarc(I) = Application.CreateArcElement1(Nothing, Wendpoint(I), Cenpt(I), Wendpoint(I + 1))
    myarc(I).Color = 20


    ActiveModelReference.AddElement myarc(I)

    myarc(I).Redraw
    Next


    linepoint(0).x = linepoints(1).x + 0.01732: linepoint(0).y = linepoints(0).y
    linepoint(1).x = linepoint(0).x + length: linepoint(1).y = linepoints(0).y

    Set myline = CreateLineElement1(Nothing, linepoint)

    myline.Color = 3
    ActiveModelReference.AddElement myline
    myline.Redraw


    For I = 0 To 2
    Wendpoint(I).x = linepoint(0).x
    Wendpoint(I).y = linepoint(0).y + Diam - I * Diam
    Wendpoint(I).Z = 0
    Next

    'Adjust center point for draw
    For I = 0 To 1
    Cenpt(I).x = linepoint(0).x - 0.5 * Diam
    Cenpt(I).y = linepoint(0).y + 0.5 * Diam - I * Diam
    Cenpt(I).Z = 0

    Set myarc(I) = Application.CreateArcElement3(Nothing, Wendpoint(I), Cenpt(I), Wendpoint(I + 1))
    myarc(I).Color = 20

    ActiveModelReference.AddElement myarc(I)

    myarc(I).Redraw
    Next

    End Sub

     

  • Takayuki:
    
    length = 0.04 
    linepoints(0).x = 0: linepoints(0).y = 0
    linepoints(1).x = linepoints(0).x + length: linepoints(1).y = linepoints(0).y 
    
    

    Use the API

    The VBA API provides methods to manipulate geometry. Point3d, for example, lets you perform vector arithmetic on points. Matrix3d is responsible for rotation.

    Using the API is more concise and expresses more clearly your intent:

    
    linepoints(0) = Point3dZero
    linepoints(1) = Point3dAdd (linepoints(0), Point3dFromXY (0.04, 0))
    ...
    For i = 0 To 4
        Wendpoint(i) = Point3dAdd (linepoints(1), Point3dFromXY (- 0.5 * Diam, 0.5 * Diam + Diam - i * Diam)
    Next
    
    

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Arc is not Cell

    Takayuki:

    I tried what you said, but I failed. Below is the drawing I created. But Arc is not cell.

    You are correct: an ArcElement is not a CellElement. In your code you create several ArcElements, but nowhere in your code do you create a CellElement.

    I think that I already suggested that you create an array of elements that are the components of your cell, then create the CellElement from your array using CreateCellElement1.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data