Reply
Solved! Go to solution

How to automate variable 'copy link' from code?

I have code that creates new variables in a SE draft document and want to get a reference to the 'copy link' path to automatically create links in Excel but haven't found a way to do it programatically.

 

Manual way:

  1. Create variable
  2. Right click variable name
  3. Select 'Copy Link'
  4. Paste link in excel cell

Link should look something like this based on cache folder path:

    =SolidEdge.DraftDocument|'C:\Users\me\AppData\Roaming\Unigraphics Solutions\Solid Edge\SEEC\corbaloc_iiop_localhost_9996_localserver\me\Default\6851.1.dft'!'!8099'

 

Tried using Solid Edge Spy but I think the right click menu is accessing a method outside of 'Variable' interface to get the reference path.

 

'Create SE Variable
Set objVar = objVars.Add(pName:="Swing", pFormula:="30", UnitsType:=igUnitScalar)
'Paste link into Excel to new SE variable
myWbk.WorkSheets("DB_Links").Range("Swing").value = objVar.???? <- how to get link ?
8 REPLIES

Re: How to automate variable 'copy link' from code?

It seems that there is no API exposed for copying the variable link, at least I can't find it...

Re: How to automate variable 'copy link' from code?

Hello,

 

seems you simply need the pathname of your draft document and the name of the Solid Edge variable (omitting the leading V) you want to link to from Excel and then build up a formula as the following sample (linking to a variable named V652):

 

=SolidEdge.DraftDocument|'D:\Benutzer\Wku\Etc\Solid Edge\Draft1.dft'!'!652'

 

This formula expression you simply assign to the desired cell in your Excel sheet.

 

 

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: How to automate variable 'copy link' from code?

The solution from Wolfgang seems to work, but I was almost sure that the SystemName of a variable did NOT correspond to the variable number in the link in the past....

Re: How to automate variable 'copy link' from code?

[ Edited ]

Wolfgang - This is the way I was headed but was hoping for a direct call to make the code more robust in the event SE changes the link format in the future.

 

Martin - Thanks for taking a look as well.  That was my conclusion too.

 

Regards

Solution
Solution
Accepted by topic author PDX_Runner
‎09-24-2015 05:21 PM

Re: How to automate variable 'copy link' from code?

PDX_Runner,

 

i just tested the Solid Edge method

 

Document.Variables.CopyToClipboard("varName")

 

This works, if you paste then within Excel the value via the option to link. Doing so the Excel cell gets filled with a formula as already discussed above Smiley Happy

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: How to automate variable 'copy link' from code?

hi there

is there a line code or something that lets one part gets a variable value from another part without using excel ?

i can do it in excel no problem

we have a standard items folder and when i do it with excel and use revision manager to create a new assembly for a new client it copies the excel file with it

then if we make an adjustment to the standard part the part in the client folder does not update

i want it to do it automatically without using excel PLEASE

thank you

Re: How to automate variable 'copy link' from code?

With a document open, you can try opening another document silently and access the variables collection there in. This will give access to the desired variable whose value can be used in the current part.

Re: How to automate variable 'copy link' from code?

i have found a way but you have to use excel

when you control a part with excel and want the control of excel but all assemblies where that standard part is used to work then when want to copy the file dont copy / paste

use revision manager BUT if you want all the parts to use that excel file for dimensioning purposes DESELECT / CLEAR ACTION on the excel file

when you do that where ever you REVISION MANAGER copy that file to

it will data link to the excel file

be careful because if an adjustment is made on a dimension it will affect ALL of the parts that is controlled by the spreadsheet

i hope this can help someone in the futur