Gets or sets the offset from the model origin of the plane that defines the display depth of a drawing view.
Visual Basic |
---|
Public Property DepthPlaneOffset As Double |
Imports System.Runtime.InteropServices Imports System.IO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objSEApp As SolidEdgeFramework.Application Dim objDoc As SolidEdgeDraft.DraftDocument Dim objModelLinks As SolidEdgeDraft.ModelLinks = Nothing Dim objModelLink As SolidEdgeDraft.ModelLink = Nothing Dim objDrawingViews As SolidEdgeDraft.DrawingViews = Nothing Dim objDrawingView As SolidEdgeDraft.DrawingView = Nothing Dim objSheets As SolidEdgeDraft.Sheets = Nothing Dim objSheet As SolidEdgeDraft.Sheet = Nothing Dim SEInstallDir As DirectoryInfo Try Try objSEApp = Marshal.GetActiveObject("SolidEdge.Application") Catch ex As Exception objSEApp = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application")) objSEApp.DisplayAlerts = True objSEApp.Visible = True End Try Dim strTemplatePath As String = "" 'Users using ST6 or prior versions may have to use different path for template. strTemplatePath = objSEApp.Documents.TemplatePath & "\ANSI Metric\ansi metric draft.dft" objDoc = objSEApp.Documents.Add("SolidEdge.DraftDocument", strTemplatePath) SEInstallDir = GetTrainingFolder() objModelLinks = objDoc.ModelLinks 'Set Link to Assembly document objModelLink = objModelLinks.Add(SEInstallDir.FullName + "\carrier.asm") 'Get Sheets Collection objSheets = objDoc.Sheets objSheet = objDoc.Sheets.Item(1) 'Get Drawing View collection from the sheet1 objDrawingViews = objSheet.DrawingViews 'Add first view objDrawingView = objDrawingViews.AddAssemblyView(objModelLink, SolidEdgeDraft.ViewOrientationConstants.igTopView, 1.0, 0.2, 0.15, SolidEdgeDraft.AssemblyDrawingViewTypeConstants.seAssemblySimplifiedView) objDrawingView = objDrawingViews.AddAssemblyView(objModelLink, SolidEdgeDraft.ViewOrientationConstants.igLeftView, 1.0, 0.4, 0.15, SolidEdgeDraft.AssemblyDrawingViewTypeConstants.seAssemblySimplifiedView) objDrawingView.SetRotationAngle(1.5708) objDrawingViews = objSheet.DrawingViews objDrawingView.DepthPlaneOffset = 0.05 'Update All Drawing views using UpdateViews method objModelLink.UpdateViews() Catch ex As Exception MsgBox(ex.ToString) Finally ' USER DISPLAY ' Release objects objSEApp = Nothing objDoc = Nothing objModelLink = Nothing End Try End Sub Function GetTrainingFolder() As DirectoryInfo Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing Dim objInstallFolder As DirectoryInfo = Nothing Dim objTrainingFolder As DirectoryInfo = Nothing Try objInstallData = New SEInstallDataLib.SEInstallData objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath()) objTrainingFolder = New DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training")) Catch Finally If Not (objInstallData Is Nothing) Then Marshal.FinalReleaseComObject(objInstallData) objInstallData = Nothing End If End Try Return objTrainingFolder End Function End Class
using System.Windows.Forms; using System.Runtime.InteropServices; using System.IO; public class Form1 { private void Button1_Click(object sender, EventArgs e) { SolidEdgeFramework.Application objSEApp = null; SolidEdgeDraft.DraftDocument objDoc = null; SolidEdgeDraft.ModelLinks objModelLinks = null; SolidEdgeDraft.ModelLink objModelLink = null; SolidEdgeDraft.DrawingViews objDrawingViews = null; SolidEdgeDraft.DrawingView objDrawingView = null; SolidEdgeDraft.Sheets objSheets = null; SolidEdgeDraft.Sheet objSheet = null; DirectoryInfo SEInstallDir = null; try { try { objSEApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application"); } catch (Exception ex) { objSEApp = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application")); objSEApp.DisplayAlerts = true; objSEApp.Visible = true; } string strTemplatePath = ""; //Users using ST6 or prior versions may have to use different path for template. strTemplatePath = objSEApp.Documents.TemplatePath + "\\ANSI Metric\\ansi metric draft.dft"; objDoc = objSEApp.Documents.Add("SolidEdge.DraftDocument", strTemplatePath); SEInstallDir = GetTrainingFolder(); objModelLinks = objDoc.ModelLinks; //Set Link to Assembly document objModelLink = objModelLinks.Add(SEInstallDir.FullName + "\\carrier.asm"); //Get Sheets Collection objSheets = objDoc.Sheets; objSheet = objDoc.Sheets.Item(1); //Get Drawing View collection from the sheet1 objDrawingViews = objSheet.DrawingViews; //Add first view objDrawingView = objDrawingViews.AddAssemblyView(objModelLink, SolidEdgeDraft.ViewOrientationConstants.igTopView, 1.0, 0.2, 0.15, SolidEdgeDraft.AssemblyDrawingViewTypeConstants.seAssemblySimplifiedView); objDrawingView = objDrawingViews.AddAssemblyView(objModelLink, SolidEdgeDraft.ViewOrientationConstants.igLeftView, 1.0, 0.4, 0.15, SolidEdgeDraft.AssemblyDrawingViewTypeConstants.seAssemblySimplifiedView); objDrawingView.SetRotationAngle(1.5708); objDrawingViews = objSheet.DrawingViews; objDrawingView.DepthPlaneOffset = 0.05; //Update All Drawing views using UpdateViews method objModelLink.UpdateViews(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { // USER DISPLAY // Release objects objSEApp = null; objDoc = null; objModelLink = null; } } public DirectoryInfo GetTrainingFolder() { SEInstallDataLib.SEInstallData objInstallData = null; DirectoryInfo objInstallFolder = null; DirectoryInfo objTrainingFolder = null; try { objInstallData = new SEInstallDataLib.SEInstallData(); objInstallFolder = new DirectoryInfo(objInstallData.GetInstalledPath()); objTrainingFolder = new DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training")); } catch { } finally { if (objInstallData != null) { Marshal.FinalReleaseComObject(objInstallData); objInstallData = null; } } return objTrainingFolder; } public Form1() { SubscribeToEvents(); } private bool EventsSubscribed = false; private void SubscribeToEvents() { if (EventsSubscribed) return; else EventsSubscribed = true; Button1.Click += Button1_Click; } }