WhoCanDo Posted August 16, 2020 Share Posted August 16, 2020 Hi, SetConstrain will set the constrains, but how do I get the constrains before I change them so I can return them to the user's preferences afterward? Basically, I want to turn Q on and off but not change any other constrain. Regards Quote Link to comment
MullinRJ Posted August 16, 2020 Share Posted August 16, 2020 Hello @WhoCanDo , The constraint settings can be accessed by preference numbers. Here's a routine I wrote a couple of years ago that will do what you're looking for. function GetSnaps :String; { Return a string with the current SNAP settings. } Var S :String; Begin S := ''; if GetPref(37) then S := 'A'; { Snap to Grid } if GetPref(1312) then S := concat(S, 'S'); { Snap to Angle } if GetPref(1314) then S := concat(S, 'D'); { Smart Points } if GetPref(1316) then S := concat(S, 'F'); { Smart Edge } if GetPref(38) then S := concat(S, 'Q'); { Snap to Object } if GetPref(1313) then S := concat(S, 'W'); { Snap to Intersection } if GetPref(1315) then S := concat(S, 'E'); { Snap to Distance } if GetPref(1317) then S := concat(S, 'R'); { Snap to Tangent } GetSnaps := S; End; { GetSnaps } Enjoy, Raymond Quote Link to comment
WhoCanDo Posted August 16, 2020 Author Share Posted August 16, 2020 Nice one Raymond, If it can be done the long way, I wonder why VW doesn't have a GetConstrain function? Thanks again 😉 Quote Link to comment
Pat Stanford Posted August 16, 2020 Share Posted August 16, 2020 There is probably not a GetConstraint because you can use PushAttrs to save all of the attributes and constraints and then restore them using PopAttrs when you are done. Use those at the begining and end of your script and you can change things as you like while the script runs and give the user back their environment just as you got it. Quote Link to comment
WhoCanDo Posted August 17, 2020 Author Share Posted August 17, 2020 I started with that theory Pat but it didn't work, resulting in my question and fabulous answer from Raymond. Regards Quote Link to comment
Pat Stanford Posted August 17, 2020 Share Posted August 17, 2020 I did not test, just went be the statement in the VS Function Reference that Push and Pop are supposed to reset constraints. If they don't please enter a bug so it can get it fixed. 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.