Greg_at_ils Posted February 16, 2012 Share Posted February 16, 2012 Do any of you scripting gurus know if it is possible to make VW edit every symbol in a drawing and change the pen or fill setting of the symbols components? Greg Quote Link to comment
Pat Stanford Posted February 16, 2012 Share Posted February 16, 2012 Smart Aleck Answer : Yes. Longer Answer: This is untested sudo code. Use with caution. H1:=FSymDef; Repeat while H1 <> Nil do Begin H2:=FInSymDef(H1); Repeat while H2 <> Nil do Begin {Code to do pen settings} H2:=NextObj(H2); End; H1:=NextObj(H1); End; Quote Link to comment
Greg_at_ils Posted February 16, 2012 Author Share Posted February 16, 2012 Thanks Pat. I was hoping for that answer. At least it's possible. I've been trying to read up on VS to understand how to do this but there's a bit of learning curve. I tried your code and I get an error in the first line: Line #1: H1:=FSymDef; | { Error: Identifier not declared. } Greg Quote Link to comment
Pat Stanford Posted February 16, 2012 Share Posted February 16, 2012 Greg, As I said, that is Sudo Code. Try this, I think it will at least compile. You have to wrap any script that uses variables in a Procedure definition that ends with a Run() statement. If you use variable you have to declare them in a Var block. Have you read Robert Anderson's treatise on VS? http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=93218#Post93218 Make sure you try this on a sample or backup file in case there are bugs. Procedure ModSymbols; var H1,H2 :Handle; Begin H1:=FSymDef; While H1 <> Nil do Begin H2:=FInSymDef(H1); While H2 <> Nil do Begin {Code to do pen settings} H2:=NextObj(H2); End; H1:=NextObj(H1); End; End; Run(ModSymbols); Quote Link to comment
Greg_at_ils Posted February 16, 2012 Author Share Posted February 16, 2012 Robert's post is great. Thanks for pointing that out. Your code does compile, thanks. I will dive into the help files to see what I need to add to do the pen settings. I appreciate your help. Greg Quote Link to comment
Greg_at_ils Posted February 16, 2012 Author Share Posted February 16, 2012 Thanks Pat. I was able to figure it out and made my first four scripts using similar concepts! Greg Quote Link to comment
DCarpenter Posted March 15, 2018 Share Posted March 15, 2018 Thanks Pat for sharing that sudo code, that helped me a lot. Dave 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.