Sam Jones Posted February 3, 2023 Share Posted February 3, 2023 I would like to create a script that creates a hyperlink object on a sheet layer that points to another sheets layer. Can I do that? How? Using vectorscript, can I create a hyperlink anywhere in the drawing pointing to anything. How? Yet again, TIA Quote Link to comment
Pat Stanford Posted February 3, 2023 Share Posted February 3, 2023 This seem to work for a file containing a sheet layer named Sht-1 and having a symbol named PTS Link. You may need/want to assign other field values (or less field values). The available fields can be seen via the magic PIO Record to WS script that I know you have. https://forum.vectorworks.net/index.php?/topic/22978-worksheet-of-pio-fields/&do=findComment&comment=249051 I don't know if it is the Target or the SheetLayer (or both) fields that need to have the data in them. And It seems to work with the concatenation of the Sheet Name and Sheet Number. I have not tested if that is required or not. I think I started with Target and it did not work so I added SheetLayer. I also have not tested what happens in a newly created Hyperlink where you don't specify any of the fields, so I don't know what the defaults are. Probably whatever is set for the Hyperlink tool in a blank file. Hope this gets you started. Procedure MakeHyperLinkDemo; {©2023 Pat Stanford - pat@coviana.com} {licensed under the Boost Software License 1.0} {https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt} {TL/DR Use as you want, attribution for source, No warranty} VAR H1 :Handle; BEGIN H1:=CreateCustomObject('Hyperlink CW',0,0,0); SetRField(H1,'Hyperlink CW','function', 'Activate Sheet Layer'); SetRField(H1,'Hyperlink CW','Target', 'Sht-1 [Sheet Title]'); SetRField(H1,'Hyperlink CW','Target', 'Sht-1 [Sheet Title]'); SetRField(H1,'Hyperlink CW','SheetLayer', 'Sht-1 [Sheet Title]'); SetRField(H1,'Hyperlink CW','EditableLabel', 'Sheet Layer Link'); SetRField(H1,'Hyperlink CW','SymbolName', 'PTS Link'); End; Run(MakeHyperLinkDemo); Quote Link to comment
Sam Jones Posted February 4, 2023 Author Share Posted February 4, 2023 Thanks Pat! That looks very very promising. I just got slammed, so I won't be able to play with it for a couple of days, but why wouldn't it work. Cool. 1 Quote Link to comment
Jonathan Pickup Posted February 4, 2023 Share Posted February 4, 2023 I don't understand why it has to be a script rather than the hyperlink tool. Is it because the hyperlink tool will not export to the PDF if you link to a saved view? Quote Link to comment
Sam Jones Posted February 4, 2023 Author Share Posted February 4, 2023 1 hour ago, Jonathan Pickup said: I don't understand why it has to be a script rather than the hyperlink tool. Is it because the hyperlink tool will not export to the PDF if you link to a saved view? If the goal is to create several hyperlinks and place them at known locations on a known sheet layer, based on discoverable data in the file, then having a script do the harvesting of data and placing the links. The goal is to create a sheet layer that contains several hyperlinks to other sheet layers laid out in a nice known array with the links appropriately named. May not sound like it is worth the scripting hassle, but I have a need, and, at the very least, playing around with this application will probably teach me stuff I can use down the road. Quote Link to comment
Sam Jones Posted February 6, 2023 Author Share Posted February 6, 2023 @Jonathan Pickup On 2/3/2023 at 7:51 PM, Jonathan Pickup said: Is it because the hyperlink tool will not export to the PDF if you link to a saved view? Jonathan, Do you know if a hyperlink will export to the PDF if linked to a Sheet Layer as opposed to a saved view, which you said will not work? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.