API - ReferenceNotFoundNotify
API - ReferenceNotFoundNotify
(OP)
in the following example the FileOpenNotify works perfectly but the ReferencenotFoundNotify doesn't seem to work.
Does Anyone have a idea y??
Regards,
Bouke
Does Anyone have a idea y??
CODE
Public WithEvents swApp As SldWorks.SldWorks
Sub init()
Set swApp = CreateObject("SldWorks.Application")
swApp.Visible = True
End Sub
Private Sub Form_Load()
init
End Sub
Private Function swApp_FileOpenNotify2(ByVal Filename As String) As Long
MsgBox "File Open Notify"
End Function
Private Function swApp_ReferenceNotFoundNotify(ByVal Filename As String) As Long
MsgBox "Reference Not Found"
End Function
Sub init()
Set swApp = CreateObject("SldWorks.Application")
swApp.Visible = True
End Sub
Private Sub Form_Load()
init
End Sub
Private Function swApp_FileOpenNotify2(ByVal Filename As String) As Long
MsgBox "File Open Notify"
End Function
Private Function swApp_ReferenceNotFoundNotify(ByVal Filename As String) As Long
MsgBox "Reference Not Found"
End Function
Regards,
Bouke






RE: API - ReferenceNotFoundNotify
What kind of reference was missing when you tested this? Missing component? Missing in-context ref?
One possibility is that your options are not set to load referenced documents. SW is not going to fail to find something its not looking for.
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: API - ReferenceNotFoundNotify
I want the macro to trigger when I open a drawings wich has lost its reference to the part/assembly (for example by renaming it) When you open such a drawing normally you get the "File not found, would you like to find it yourself"-dialog box.
Now when I let my macro listen for this event Solidworks wont respond. It doesn't pop up the dialog either. Instead it changes the drawings-views to empty crosses.
But when I open anything It will respond with the fileopen-event.
Me and my Var were able to get it working using VBA, but I really need this in VB6.0
Regards, Bouke
RE: API - ReferenceNotFoundNotify
I wanted to do this also, but could not figure it out. What I did was put my code into code that most people already use every time they work on a drawing, assembly or part. If you figure this trigger out could you please post it? I would love to incorporate the trigger into my programs.
Bradley
RE: API - ReferenceNotFoundNotify
Evan T. Basalik, MCSD
--------------------------------
It's all about prioritization...
RE: API - ReferenceNotFoundNotify
One thing I noticed about events:
If you have too much code responding to a single event, your program can miss other events. It's possible that your MsgBox is drowning out subsequent event calls.
One way around this is to start your code asynchronously. If your code is in a form, you can use a timer. Have the event enable a timer, then have the timer run some code after a minimal wait and then disable itself.
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: API - ReferenceNotFoundNotify
Bouke Brouwers
Mechanical Engineer
SW2005 SP0.1
RE: API - ReferenceNotFoundNotify
Evan T. Basalik, MCSD
--------------------------------
It's all about prioritization...
RE: API - ReferenceNotFoundNotify
Regards,
Bouke Brouwers
Mechanical Engineer
SW2005 SP0.1
RE: API - ReferenceNotFoundNotify
Is this worth researching further?
Evan T. Basalik, MCSD
--------------------------------
It's all about prioritization...
RE: API - ReferenceNotFoundNotify
The notify is working fine now. I even found a SPR, but it wasn't a general one so overlooked it the first time.
Bradley, do you still want to know how to use this??
Regards,
Bouke Brouwers
Mechanical Engineer
SW2005 SP0.1
RE: API - ReferenceNotFoundNotify
Yes, I would like to know how to start a Visual Basic 6 exe program when SolidWorks starts. Currently, what I have to do is start a drawing, then my macro keys will work.
Bradley
RE: API - ReferenceNotFoundNotify
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: API - ReferenceNotFoundNotify
CODE
Set Part = swApp.ActiveDoc
' This program runs when I pushed Ctrl F12
MyAppID = Shell("\\ServerName\Eng\Applications\SolidWorks\Executables\Titleblock.exe", 1)
Bradley
RE: API - ReferenceNotFoundNotify
it sounds to me that you want the Titleblock.exe program to run automatically when you start SW.
You could add the following function to your program. Then put it into your init() or main()
Now when you start titleblock.exe it will look for Solidworks 2005. If its not there it will aumatically start SW2005.
So this way you dont need your SW-icon anymore
CODE
On Error Resume Next
' start solidworks
Set swApp = Nothing
Set swApp = GetObject(, "SldWorks.Application.13")
If swApp Is Nothing Then Set swApp = CreateObject("SldWorks.Application.13")
If Not swApp Is Nothing Then
swApp.Visible = True
swApp.UserControl = True
bReady = True
End If
End Function
btw, If you work in 2004 you need to change the application number from 13 to 11. I think, I'm not sure on that one though. If its not working, experiment with other numbers below 13
Bouke Brouwers
Mechanical Engineer
SW2005 SP1.0
RE: API - ReferenceNotFoundNotify
I will give this a try soon. I do use SolidWorks 2005. This will help a lot in setting the revision on our drawings to our standard. I read our “revision-version” in the format R01-01 and use VB to change it to R01 in our title block.
Thanks again
Bradley