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

Offset Line Element using Offset method of BsplineCurve object, accurately

$
0
0

Hi,

I want to offset a Line Element on both sides using Offset method of BsplineCurve, I have written code, which first convert Line to BsplineCurve and do offset, I want Offset BsplineCurve  convert back to Line element, I am not getting accurate points after offset, here is the code : 

Sub Line_Offset() ' Line Element offset using method Offset of BsplineCurve
Dim oEnumerator As ElementEnumerator
Dim bSpl As BsplineCurve
Set bSpl = New BsplineCurve
Dim bSpl_First As BsplineCurve
Dim bSpl_Second As BsplineCurve
'Set bSpl_First = New BsplineCurve
Set oEnumerator = ActiveModelReference.GetSelectedElements
Do While oEnumerator.MoveNext
If oEnumerator.Current.IsLineElement Then
Dim oLines As LineElement
Set oLines = oEnumerator.Current.AsLineElement

If (oLines.IsTraversableElement) Then
Dim dblLength As Double
bSpl.FromElement oLines
dblLength = bSpl.ComputeCurveLength

Set bSpl_First = bSpl.Offset(1.7, Matrix3dZero)
Set bSpl_Second = bSpl.Offset(-1.7, Matrix3dZero)

Dim bSpl_First_Ele As BsplineCurveElement
Dim bSpl_Second_Ele As BsplineCurveElement
Set bSpl_First_Ele = CreateBsplineCurveElement1(Nothing, bSpl_First)
Set bSpl_Second_Ele = CreateBsplineCurveElement1(Nothing, bSpl_Second)

' bSpl_First_Ele (BsplineCurveElement)to be converted to line element which will the offset
' and converted Line element should be accurate, as we will do manually using offset command

Loop
End Sub

I want to do offset on both sides of line using offset method of BsplineCurve (with accuracy, as if we do manually using offset command), after that want to convert both offset BsplineCurve to Line Element

any suggestions?

Thanks & Regards,

(mmk)


Viewing all articles
Browse latest Browse all 4331


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