Offsets the end connected elements from the SelectSet in the direction of the 2d point by the given distance. This function will clear the SelectSet and add the offset elements to the SelectSet.
Visual Basic |
---|
Public Sub Offset2d( _ ByVal offsetSideX As Double, _ ByVal offsetSideY As Double, _ ByVal offsetDistance As Double _ ) |
Private Sub Offset2D_Click(sender As Object, e As EventArgs) Handles Offset2D.Click Dim objApplication As SolidEdgeFramework.Application Dim Line As SolidEdgeFrameworkSupport.Line2d Dim DraftDoc As SolidEdgeDraft.DraftDocument Dim SelectSet As SolidEdgeFramework.SelectSet Dim Sheet As SolidEdgeDraft.Sheet = Nothing Dim x As Double Dim y As Double Try ' Create/get the application with specific settings objApplication = Marshal.GetActiveObject("SolidEdge.Application") ' open the document mentioned in the doc files. DraftDoc = objApplication.ActiveDocument Sheet = DraftDoc.Sheets.Item(1) Line = Sheet.Lines2d.Item(1) Line.GetEndPoint(x, y) Sheet.ChainLocate(x, y) SelectSet = DraftDoc.SelectSet Sheet.Offset2d(x + 0.005, y + 0.005, 0.005) Catch ex As Exception MsgBox(ex.ToString) Clipboard.SetText(ex.ToString) End Try End Sub
using System.Windows.Forms; private void Offset2D_Click(object sender, EventArgs e) { SolidEdgeFramework.Application objApplication = null; SolidEdgeFrameworkSupport.Line2d Line = null; SolidEdgeDraft.DraftDocument DraftDoc = null; SolidEdgeFramework.SelectSet SelectSet = null; SolidEdgeDraft.Sheet Sheet = null; double x = 0; double y = 0; try { // Create/get the application with specific settings objApplication = Marshal.GetActiveObject("SolidEdge.Application"); // open the document mentioned in the doc files. DraftDoc = objApplication.ActiveDocument; Sheet = DraftDoc.Sheets.Item(1); Line = Sheet.Lines2d.Item(1); Line.GetEndPoint(x, y); Sheet.ChainLocate(x, y); SelectSet = DraftDoc.SelectSet; Sheet.Offset2d(x + 0.005, y + 0.005, 0.005); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Clipboard.SetText(ex.ToString()); } } public <class name>() { SubscribeToEvents(); } private bool EventsSubscribed = false; private void SubscribeToEvents() { if (EventsSubscribed) return; else EventsSubscribed = true; Offset2D.Click += Offset2D_Click; }