Register  Login   Search
 Latest Posts Minimize

RE: Solid edge reports using an excel macro ?
Solid Edge Programming
09/07/2010 9:49 AM
jason.newell

Creating StructuralFrame - SE20, VB6
Solid Edge Programming
09/07/2010 9:27 AM
Nirantar.Vidyarthee

Solid edge reports using an excel macro ?
Solid Edge Programming
09/06/2010 5:02 PM
jvizi

RE: Remove unused Linestyles
Solid Edge Programming
09/03/2010 7:45 AM
jr199

Remove unused Linestyles
Solid Edge Programming
09/02/2010 1:25 PM
kmwolf

How to read block in a dft file without opening the dft file?
Solid Edge Programming
09/02/2010 9:02 AM
assassin.007

Inquire Element - Measure Diameter by VBA
Solid Edge Programming
09/02/2010 6:40 AM
JM

dissolve Reference to SubASM - how to??
Solid Edge Programming
09/02/2010 2:23 AM
LIHE

RE: Using Insight on a 64 bit Computer
Solid Edge General
08/31/2010 7:47 AM
Atom

Using Insight on a 64 bit Computer
Solid Edge General
08/30/2010 3:06 PM
Atom

RE: File Properties using VB.NET leave file locked
Solid Edge Programming
08/30/2010 9:57 AM
JBZ

RE: File Properties using VB.NET leave file locked
Solid Edge Programming
08/30/2010 3:20 AM
jr199

File Properties using VB.NET leave file locked
Solid Edge Programming
08/27/2010 4:36 PM
JBZ

RE: XLS link to the part
Solid Edge Programming
08/27/2010 4:11 PM
JBZ

RE: Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/27/2010 3:27 AM
jr199

vb6 se20 - solid edge Part - Hole size
Solid Edge Programming
08/26/2010 9:42 PM
cadraw

vb6 se20 - how to Drawing View Depth
Solid Edge Programming
08/26/2010 9:24 PM
cadraw

RE: Problem while getting the objects using "SelectSet" property.
Solid Edge Programming
08/26/2010 7:35 AM
jr199

RE: About the "Callout"!
Solid Edge Programming
08/26/2010 3:42 AM
fatkids

RE: Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/25/2010 3:28 AM
ErWo

RE: help to transfer C# codes as following to C++ codes?
Solid Edge Programming
08/24/2010 10:12 PM
assassin.007

RE: FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/24/2010 3:47 PM
peter6396

Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/24/2010 4:09 AM
LIHE

RE: FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/24/2010 1:28 AM
ErWo

help to transfer C# codes as following to C++ codes?
Solid Edge Programming
08/23/2010 10:34 PM
assassin.007

Problem while getting the objects using "SelectSet" property.
Solid Edge Programming
08/22/2010 7:59 AM
pratap

FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/20/2010 4:12 AM
peter6396

RE: AddLoftedFlange in SheetMetal
Solid Edge Programming
08/19/2010 4:33 AM
jason.newell

RE: PartList Positioning
Solid Edge Programming
08/19/2010 2:10 AM
ErWo

RE: Alternate Assemblies
Solid Edge Programming
08/18/2010 4:54 PM
peter6396


  
 Forums Minimize

Subject: Product Configurator / Draft Automation
Prev Next
You are not authorized to post a reply.

Author Messages
John SlipecUser is Offline
New Member
New Member
Posts:1

10/06/2005 1:47 PM  
Hey Jason, thanks for all your (and Greg's) hard work in getting all that material together for the summit. Flying out to Cincinnati was worth it alone just for that pre-conference.

I've been tinkering with .NET and solid edge for several months now and have been semi-successful. I am trying to build a little "product configurator" for one of our new product lines. The idea is once done a customer service person could design the product without ever seeing solid edge, and produce all drawings and documentation within clicks.

I am at the point where I need to open all the draft files in my project, change some titelblock properties, update them and print them. Basically I have a collection that stores all the draft file names and then it just cycles through each one, opening them and attempting to update them. The smarter way would be to use the revision manager API's but I've already got it half coded this way. Unfortunately I couldn't find any examples on your cd where you open and update documents. Here is my code that I have a question about:


Private objApp As SolidEdgeFramework.Application
Private objDraft As SolidEdgeDraft.DraftDocument
Private objLink As SolidEdgeDraft.ModelLink

Try
objApp = Marshal.GetActiveObject("SolidEdge.Application")
Catch
objApp = MarshalEx.CreateObject("SolidEdge.Application")
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

'Recoginze your Marshal class being utilized? Thanks again for your code at the summit!

objApp.Visible = False
objApp.Interactive = False
objApp.DisplayAlerts = False


objDraft = objApp.Documents.Open("filename.dft")
'This is the point that blows up on me
objLink = objDraft.ModelLinks
objLink.UpdateViews()
objDraft.Save()


When I call upon objLink I get a "cast is invalid" type of error. I've dug through everything in my objApp and objDraft objects and cannot find any way to update these drawings.


Thanks in advance
Jason NewellUser is Offline
Site Administrator
Site Member
Site Member
Posts:813

10/06/2005 2:13 PM  
John,

Good to hear from you!

I pasted some code for you below. Take a look at it and see if it's what you're needing. If not, let me know.


  
Imports System.Runtime.InteropServices

Module Module1

Sub Main()
Dim objApp As SolidEdgeFramework.Application
Dim objDraft As SolidEdgeDraft.DraftDocument
Dim objModelLinks As SolidEdgeDraft.ModelLinks
Dim objModelLink As SolidEdgeDraft.ModelLink
Dim i As Integer

objApp = Marshal.GetActiveObject("SolidEdge.Application")
objDraft = objApp.ActiveDocument
objModelLinks = objDraft.ModelLinks

For i = 1 To objModelLinks.Count
objModelLink = objModelLinks.Item(i)
objModelLink.UpdateViews()
Next

End Sub

End Module

Jason Newell
Software Engineer
www.jasonnewell.net
John SlipecUser is Offline
New Member
New Member
Posts:1

10/06/2005 2:33 PM  
Wow thanks for the super fast response

Works like a charm! I have your code integrated and working exactly the way I need it to. I'm sure I will have more question in the near future as I try new things with .NET / solid edge.

With myself it's just like what Greg said "I don't know how to program but I do know what has worked before and how to reproduce it."

Jason NewellUser is Offline
Site Administrator
Site Member
Site Member
Posts:813

10/06/2005 5:47 PM  
Yeah, under 30 min .

Try and get that from UGS .

I'm teasing . UGS support is good ;-).

Glad you got the answer your were looking for.

Jason Newell
Software Engineer
www.jasonnewell.net
harryUser is Offline
New Member
New Member
Posts:7

02/04/2010 3:31 AM  

Hello,

I saw this topic but i had another similar question. I want to check with VB if the drawing needs a update, but i don't know how.

(And if the drawing needs an update then i can give the user a msgbox warning, update the drawing and change the filename of the pdf-file.)

I hope somebody can help me.

harryUser is Offline
New Member
New Member
Posts:7

02/04/2010 3:32 AM  

Maybe I need to mention that I already tried several things but they don't work:

If objDoc.ModelLinks(1).UpdateViews = False Then MsgBox "..."

If objDoc.ActiveSheet.DrawingView(8).IsUpToDate = True Then MsgBox "True"

ErWoUser is Offline
Site Member
Site Member
Posts:35

02/08/2010 3:56 AM  

Hello Harry,

This Code works. Let me know if your problem is'nt solved.

Public Sub UpdateDraft()
On Error Resume Next
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objDrawingViews As SolidEdgeDraft.DrawingViews
Dim objDrawingView As SolidEdgeDraft.DrawingView
Dim DrawingViewNeedsUpdate As Boolean
'Get SE en open document
    Set objApp = GetObject(, "SolidEdge.Application")
    If Err Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
    End If
    'Open document
    Set objDoc = objApp.ActiveDocument
   
    'Visible
    objApp.Visible = True
    objApp.DisplayFullScreen = True
   
'Set
    Set objSheet = objDoc.ActiveSheet
    Set objDrawingViews = objSheet.DrawingViews
   
    DrawingViewNeedsUpdate = False
   
'Loop throug the drawingviews and check each one of them.
'If one of the views is out of date, the Boolean is True
    For Each objDrawingView In objDrawingViews
        If objDrawingView.IsUpToDate = False Then
            DrawingViewNeedsUpdate = True
            Exit For
            DrawingViewNeedsUpdate = True
        Else
            DrawingViewNeedsUpdate = False
        End If
    Next
   
'Show the messagebox
    If DrawingViewNeedsUpdate = True Then
        MsgBox "Update the drawing and change the filename of the pdf-file"
    End If
'Release variables
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objSheet = Nothing
   
    Set objDrawingViews = Nothing
    Set objDrawingView = Nothing
   
End Sub

Best Regards,

Wouter (Erwo)

SandeepUser is Offline
New Member
New Member
Posts:17

02/08/2010 10:53 PM  

Dear John,

If you want to change the file properties or some title boxes in draft file, it doesn't require to open the file in SolidEdge simply you can use file system object and you can add Title, any custom properties etc. which will save a lot of time for opening and closing of a file in SolideEdge.

Just try with file system object.

All the Best,

Sandeep Shewale

harryUser is Offline
New Member
New Member
Posts:7

02/09/2010 1:49 AM  
Thanks Wouter!

You used the same methode as i did, but with you the code worked.
So i did some more testing and this was the problem:
1) If objDoc.ActiveSheet.DrawingView(1).IsUpToDate = False Then MsgBox "False"
2) If objDoc.ActiveSheet.DrawingViews.Item(1).IsUpToDate = False Then MsgBox "False"

line 1 doesn't work, and line 2 works fine. So that was the problem. Thanks anyway
BTW are you from holland? (I am from holland)


When i open a drawing with drawingviews that are not up to date i get a warning message.
Does anybody know how to not display this message?
JRUser is Offline
Site Member
Site Member
Posts:78

02/09/2010 5:16 AM  
before you open the drawing you can switch all alerts off:
objApp.DisplayAlerts=False
harryUser is Offline
New Member
New Member
Posts:7

02/09/2010 5:46 AM  
yes i know, but i want to hide just this "update views" message.
Is that possible?
ErWoUser is Offline
Site Member
Site Member
Posts:35

02/09/2010 9:04 AM  

Hi Harry,

I don't know a way to hide that specific warning. But what you can do is what John says; set DisplayAlerts to False. Then, when Solid Egde has fired the 'AfterDocumentOpen' event (see Solid Edge Spy), you can set the DisplayAlerts property back to True.

Good luck,

Best Regards,

Wouter (Erwo)

p.s. I'am indeed from the Netherlands, sent me an email for contact information. 

harryUser is Offline
New Member
New Member
Posts:7

02/09/2010 12:24 PM  
Thats wat i already did in my code.
but i guess i will have to keep it that way, for now ;)

Thanks anyway, JR and ErWo.
You are not authorized to post a reply.
Forums > Solid Edge > Programming > Product Configurator / Draft Automation



ActiveForums 3.7

  

 Users Online Minimize

Membership Membership:
Latest New User Latest: lumpypumpkin
New Today New Today: 2
New Yesterday New Yesterday: 2
User Count Overall: 1972

People Online People Online:
Visitors Visitors: 3
Members Members: 0
Total Total: 3

Online Now Online Now:

  

The Code Project

Spatial Freedom Astroid

Use OpenDNS

Copyright 2010 JasonNewell.NET   Terms Of Use  Privacy Statement