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

[v8i SelectSeries 4] Convert to BsplineCurveElement

$
0
0

Hi all,

I'm new to microstation VBA coding and would like everyones input on my problem. My VBA code in Excel does the following


1. Opens and creates a microstation DGN file named "DrawPoints"
2. Iterates through coordinate values in excel sheet and converts them to microstation points 

3. Draws these points using the Bspline Curve "Through points" tool (about 700 points).

It produces the curve in the attached image which is correct for my needs

How can I reference this curve and convert it to a BSplineCurveElement that I can manipulate in VBA?

At the moment, the curve that is generated isn't something I can call upon in my code. I assume I have to scan for the element using ElementScanCriteria but I'm not sure how to select and Dim the element after scanning it.

Thanks for the help in advance!

Sub DrawPoints()

Dim o As MicroStationDGN.Application
Dim oAL As ApplicationObjectConnector
Dim myDGN As DesignFile

'Create DGN File titled "DrawPoints"
Set oAL = New ApplicationObjectConnector
Set o = oAL.Application
o.Visible = True

Set myDGN = o.CreateDesignFile("seed2d", "DrawPoints", True)'Find corresponding coordinates
Dim Coordinate() As Point3d
Dim Ro As Double
Dim StartRo As Double
Dim MaxRo As Double
Dim Xpt As Double
Dim Ypt As Double
Dim point() As Point3d

StartRo = 23
MaxRo = Sheets("Coordinates").Range("A9999").End(xlUp).Row

o.CadInputQueue.SendCommand "PLACE CURVE ICON"
o.SetCExpressionValue "tcb->ms3DToolSettings.curve.type", 2, "3DTOOLS" 'Enables curve through points option

For Ro = StartRo To MaxRo

    Xpt = Sheets("Pantograph").Cells(Ro, 1)
    Ypt = Sheets("Pantograph").Cells(Ro, 2)
    If Xpt + Ypt = 0 Then Exit For

    ReDim Preserve Coordinate(Ro - StartRo)
    Coordinate(Ro - StartRo) = o.Point3dFromXY(Xpt, Ypt)

    point = Coordinate
    o.CadInputQueue.SendDataPoint point(Ro - StartRo), 1

Next Ro

o.CadInputQueue.SendReset

o.CadInputQueue.SendCommand "FIT VIEW EXTENDED 1"

End Sub


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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