Is there a way to get an automatic note (link property I guess) on a drawing template (in the title block for instance) with the Solidworks release version? (e.g. 2015 SP2).
Correct, the note will not update itself, but it is the correct starting point for solving this problem using the API. For example, for use with an add-in or macro that runs automatically in the background that updates the note every time a drawing is opened.
SolidWorks API Tutorials
I'm pretty sure there isn't any "out of the box" way to do this, but someone may be able to write a macro to do it. I'd suggest moving this Discussion to the API section of the forum. (Click on Move under Actions near top right to move a Discussion.)
Any specific reason you want to do that? The reason I'm asking is that a model/drawing made in say 2013 and saved/updated to 2015 will not reflect the correct scenario.
We put the SW version on our drawing so when we share a drawing made in 2015 to a partner that would use a previous version, we understand why it does not open. It is not mandatory, but nice to have.
Currently this information is on our drawing templates and we need to think to update the templates when we update SW version. Therefore an automation of this would prevent any mistake/forgetting.
Florimond Laporte wrote: We put the SW version on our drawing so when we share a drawing made in 2015 to a partner that would use a previous version, we understand why it does not open. It is not mandatory, but nice to have.
Florimond Laporte wrote:
If they can't open it then how would they know as which version it was made on. I don't want to argue but just trying to understand, so that we can try to move this need as enhancement request.
This is a proper question Deepak, and you are right in your assumption. Let just say that I send a drawing to a partner, they reply that they cannot open it. Then I look at the drawing and I see that it is made in a version more recent then the one our partner have.
Or they have the pdf upfront and already know that it they ask for the solidwork model/drawing, it won't work for them.
If I am the only one doing this, I say there is no need for an ER, but I am just asking around if there is a way to do this elegantly. Updating manually the template is not such a burden.
A free eDrawings viewer is all they need in case they want to just look at it.
The attached macro will replace the text in a selected note with the SolidWorks version in format you specified above. You can read instructions on how to assign this to macro shortcut here. After that button is created you can assign a keyboard shortcut. Otherwise you will need to run it via Tools-->Macros-->Run.
Here is the code:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swNote As SldWorks.Note
Dim vSplit As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swNote = swSelMgr.GetSelectedObject6(1, -1)
vSplit = Split(swApp.RevisionNumber, ".")
swNote.SetText CStr(1992 + vSplit(0)) & " SP" & vSplit(1)
SolidWorks API Training
It works quite well, though it is not what I was looking for.
I would like that the note update itself, without any action from me, each time the drawing is open and/or rebuild.
Like a note linked to a property.
Or maybe what I need is a property that is the solidworks version. Could I use swApp.RevisionNumber as a custom property?
Retrieving data ...