Jump to content
Developer Wiki and Function Reference Links ×

How do I copy a VW2024 VSM to VW2023?


Tom W.

Recommended Posts

I have a Vectorscript plug-in menu command which I made in VW2024. I am doing most of my work in VW2023 though so wanted to grab that VSM + put it in my VW2023 workspace so I could use it there. I assumed it would just be a matter of copying the file from the VW2024 plug-ins folder + pasting it into my VW2023 plug-ins folder, closing VW + reopening it + there it'd be in the workspace editor but it's not. I didn't think VSMs were version-specific so thought this would work...?

 

I could go into VW2024 + copy the script itself from the Plug-in Manager, then go into VW2023 + create a new VSM in the Plug-in Manager there but I'm sure I shouldn't need to do it this way...

 

Thanks

Link to comment

Time’s arrow flows one direction, unfortunately. You can migrate a VSM forwards, but not backwards. Your only option is to re-create the plug-in in 2023. Any updates you make in 2023 you can migrate to 2024 by copying the plug-in. 
 

if you use external includes for your code, both versions can include the same text file and stay up to date. 

  • Like 2
Link to comment

Thank you @JBenghiat ok I think that explains my confusion: all the VSMs I've ever imported must have been from the current or an earlier version of VW + so came in seamlessly + that led me to think the version didn't matter. Next time if I'm working between versions I will remember to create the plug-in in the earlier version rather than the later one! Thanks.

Link to comment

Ok in the process of copying the script back to VW2023 I decided to improve on it 🙂. The script searches for 2D + 3D Loci across the file + deletes all of them except for those in 'NonPlot' class plus I've realised any which are inside symbols or Groups. I thought I would see if I could modify it so that it found loci inside of symbols + Groups as well.

 

First off I can't get insymbol to have any effect:

 

DSelectAll; 
SetLayerOptions(5);
SelectObj(INSYMBOL & (C<>'NonPlot') & ((T=LOCUS) | (T=LOCUS3D)));
DeleteObjs;
SetLayerOptions(4);

 

Should I be doing it differently? The line above is how I'd do it in a worksheet...

 

Then secondly, I have no idea how to get to the loci in Groups. In a worksheet it finds Grouped objects automatically so what do I need to do to my script to achieve the same?

 

Many thanks anyone who can help. In case it's not already obvious I know nothing about scripting.

Link to comment

It's the only reason I still use VW2019 at this point.  I do all of my development in 2019 so that the plug-ins will work in any version between 2019 and now.  The language hasn't changed much at all, mostly new object variables and a handful of more convenient functions, but it's pretty rare when I come across something that must be in a newer version.

  • Like 1
Link to comment

I think you are missing one set of parentheses in your SelectObj criteria.  It should be (INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))).

 

Also, a more efficient way to achieve what you are doing would be through a ForEachObject call.  It would make the script one line since there's no need for variables.

 

ForEachObject(DelObject,(INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))));

 

Edited by Jesse Cogswell
  • Like 1
  • Love 1
Link to comment

Thanks Jesse but unfortunately it's still not working... In fact it seems to be doing something strange now where I select the symbol + it's saying it's a Group in the OIP, and then when I enter the real Group it won't let me exit again...!

 

Incidentally I am a bit clueless about the rules for parenthesis: I generally just fumble around trying out different combinations until I happen upon something that works. Presumably there's a correct way I'm not aware of yet...

Link to comment

The technique of acting on selected objects is what is giving you trouble. Selection status is really just a flag, so objects inside symbols can maintain their selection status, but not be directly editable (if you were to manually edit the symbol, you would then see those objects selected).

 

Any operations beyond basics should be done via handles as opposed to selected objects. In this case, you want to traverse the drawing structure, not just act on selected objects. Using @Jesse Cogswell's ForEachObject will work, as well the similar ForEachObjectInList. You can find several use examples as well as discussions of working with handles in the forum archives.

  • Like 1
Link to comment
2 hours ago, Jesse Cogswell said:

I think you are missing one set of parentheses in your SelectObj criteria.  It should be (INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))).

 

Also, a more efficient way to achieve what you are doing would be through a ForEachObject call.  It would make the script one line since there's no need for variables.

 

ForEachObject(DelObject,(INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))));

 

 

Jesse apologies I didn't see the edit to your post until later. This new script is perfect thank you! My script above started off as a Custom Selection + was initially just a way to select all the errant loci I'd peppered the drawing with in order to then manually delete them. Then I added the delete part. Then I added the parts to make the layer options 'Show Snap Modify Others' then return to 'Show Snap Others'. I guess I thought I could just carry on adding parts to it... 🙂

 

But this has been a good lesson thank you.

 

1 hour ago, JBenghiat said:

The technique of acting on selected objects is what is giving you trouble. Selection status is really just a flag, so objects inside symbols can maintain their selection status, but not be directly editable (if you were to manually edit the symbol, you would then see those objects selected).

 

Any operations beyond basics should be done via handles as opposed to selected objects. In this case, you want to traverse the drawing structure, not just act on selected objects. Using @Jesse Cogswell's ForEachObject will work, as well the similar ForEachObjectInList. You can find several use examples as well as discussions of working with handles in the forum archives.

 

This is helpful too thank you.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...