Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheets As SolidEdgeDraft.Sheets
Dim objSheet As SolidEdgeDraft.Sheet
Dim objTextProfiles As SolidEdgeFrameworkSupport.TextProfiles
Dim objTextProfile As SolidEdgeFrameworkSupport.TextProfile
Dim objLineSpacing As Double
Dim count As Long
Dim dblMargin As Double
Dim dblLetterSpacing As Double
Dim smoothness As Long
Dim textsize As Double
Dim textprofile As String
Dim xfrom, yfrom, xto, yto As Double
Dim font As String
Dim justifvalue As SolidEdgeFrameworkSupport.TextNumberJustificationConstants
Dim anchorptloc As SolidEdgeFrameworkSupport.AnchorPointLocationConstants
Dim x As Double
Dim y As Double
Try
xfrom = 0.5
yfrom = 0.5
xto = 0.7
yto = 0.7
objApp = Marshal.GetActiveObject("SolidEdge.Application")
objDoc = objApp.ActiveDocument
objSheets = objDoc.Sheets
objSheet = objDoc.ActiveSheet
objTextProfiles = objSheet.TextProfiles
objTextProfile = objTextProfiles.Item(1)
textprofile = objTextProfile.Text
anchorptloc = objTextProfile.AnchorPointLocation
Call objTextProfile.GetAnchorPoint(x, y)
Call objTextProfile.SetAnchorPoint(0.4, 0.4)
objTextProfile.AnchorPointLocation = SolidEdgeFrameworkSupport.AnchorPointLocationConstants.igAnchorPointMiddleRight
anchorptloc = objTextProfile.AnchorPointLocation
Call objTextProfile.GetAlignment(0, justifvalue)
font = objTextProfile.FontName
count = objSheet.TextProfiles.Count
objLineSpacing = objTextProfile.LineSpacing
dblMargin = objTextProfile.Margin
dblLetterSpacing = objTextProfile.LetterSpacing
smoothness = objTextProfile.Smoothness
textsize = objTextProfile.TextSize
Call objTextProfile.Move(xfrom, yfrom, xto, yto)
objTextProfile.Copy()
objTextProfile.Delete()
'objTextProfile.Cut()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1
{
private void Button1_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objApp = null;
SolidEdgeDraft.DraftDocument objDoc = null;
SolidEdgeDraft.Sheets objSheets = null;
SolidEdgeDraft.Sheet objSheet = null;
SolidEdgeFrameworkSupport.TextProfiles objTextProfiles = null;
SolidEdgeFrameworkSupport.TextProfile objTextProfile = null;
double objLineSpacing = 0;
long count = 0;
double dblMargin = 0;
double dblLetterSpacing = 0;
long smoothness = 0;
double textsize = 0;
string textprofile = null;
double xfrom = 0;
double yfrom = 0;
double xto = 0;
double yto = 0;
string font = null;
SolidEdgeFrameworkSupport.TextNumberJustificationConstants justifvalue = null;
SolidEdgeFrameworkSupport.AnchorPointLocationConstants anchorptloc = null;
double x = 0;
double y = 0;
try
{
xfrom = 0.5;
yfrom = 0.5;
xto = 0.7;
yto = 0.7;
objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
objDoc = objApp.ActiveDocument;
objSheets = objDoc.Sheets;
objSheet = objDoc.ActiveSheet;
objTextProfiles = objSheet.TextProfiles;
objTextProfile = objTextProfiles.Item(1);
textprofile = objTextProfile.Text;
anchorptloc = objTextProfile.AnchorPointLocation;
objTextProfile.GetAnchorPoint(x, y);
objTextProfile.SetAnchorPoint(0.4, 0.4);
objTextProfile.AnchorPointLocation = SolidEdgeFrameworkSupport.AnchorPointLocationConstants.igAnchorPointMiddleRight;
anchorptloc = objTextProfile.AnchorPointLocation;
objTextProfile.GetAlignment(0, justifvalue);
font = objTextProfile.FontName;
count = objSheet.TextProfiles.Count;
objLineSpacing = objTextProfile.LineSpacing;
dblMargin = objTextProfile.Margin;
dblLetterSpacing = objTextProfile.LetterSpacing;
smoothness = objTextProfile.Smoothness;
textsize = objTextProfile.TextSize;
objTextProfile.Move(xfrom, yfrom, xto, yto);
objTextProfile.Copy();
objTextProfile.Delete();
//objTextProfile.Cut()
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public Form1()
{
SubscribeToEvents();
}
private bool EventsSubscribed = false;
private void SubscribeToEvents()
{
if (EventsSubscribed)
return;
else
EventsSubscribed = true;
Button1.Click += Button1_Click;
}
}