Reply

Hide refPlanes, hide sketches, fit on window, Isometric View

[ Edited ]

 

Hello all.

I want write code, which hide refPlanes, hide sketches, fit on window and isometric view before save part document.

At this time I know, what hide refPlanes and fit on window:

        objDoc.ToggleRefPlanesDisplay (False)

 

        Set wd = objApp.ActiveWindow

        wd.View.Fit

But how hide sketches and do isometric view (hotkey Ctrl+I) I don't know.

Please help me!

 

Posted by: Anton Bykov
Post date: 6/1/2010 6:49:30 PM

3 REPLIES

RE: Hide refPlanes, hide sketches, fit on window, Isometric View

[ Edited ]

 

Frantic,

 

This will work for parts, you have to rewrite it for other environments.

 

Good luck!

____________________________________________________________________________

 

Public Sub HideSketchesAndPutInIsoView()

On Error Resume Next

Dim objApp As SolidEdgeFramework.Application

Dim objDoc As SolidEdgePart.PartDocument

Dim objSketches As SolidEdgePart.Sketchs

Dim objSketch As SolidEdgePart.Sketch

Dim objProfiles As SolidEdgePart.Profiles

Dim objProfile As SolidEdgePart.Profile

'Get SE

    Set objApp = GetObject(, "SolidEdge.Application")

    If Err Then

        Err.Clear

        Set objApp = CreateObject("SolidEdge.Application")

    End If

    objApp.Visible = True

 

'Set

    Set objDoc = objApp.ActiveDocument

    Set objSketches = objDoc.Sketches

'Loop through all the sketches and profiles (do something similar in the assembly environment,

'sketch are called layouts there. Use the Spy to check it out.

    For Each objSketch In objSketches

        Set objProfiles = objSketch.Profiles

        For Each objProfile In objProfiles

            objProfile.Visible = False

        Next

    Next

 

'Isoview (make sure to have made a reference to the SolidEdge Constants Type Library. Use the Event Spy

'to get the command Id's

    'Call objApp.StartCommand (AssemblyCommandConstants.AssemblyViewISOView) 'Assembly

    Call objApp.StartCommand(partCommandConstants.partViewISOView) 'Part

 

'Release objects

    Set objApp = Nothing

    Set objDoc = Nothing

    Set objSketches = Nothing

    Set objSketch = Nothing

End Sub

 

Posted by: Wouter Sloof
Post date: 6/1/2010 7:54:04 PM

RE: Hide refPlanes, hide sketches, fit on window, Isometric View

[ Edited ]

ErWo, thank you.

It worked!!!

 

Posted by: Anton Bykov
Post date: 6/1/2010 8:08:57 PM

Re: RE: Hide refPlanes, hide sketches, fit on window, Isometric View

Can you share with me this macro, i put this code to VS, but i did something wrong,  and it doesn`t work. thanks