Hey everyone! I just got into scripting a couple of days ago and I want to start tracking my progress and potentially get some pointers and some feedback from more advanced scripters. I'm still very new and my stuff is super simple, so don't get your hopes up for anything awesome.
Here's the first script that I made. I got it by chopping up
Perna's SmartCreate script and making it into something else that I could use. In vertex mode, it enters cut mode; in edge mode, it spins the edge; and in face mode, it will flip the face. It works pretty well.
--Cut verts
if (subobjectlevel==1) then
macros.run "Editable Polygon Object" "EPoly_Cut"
--Spin edge
else if (subobjectlevel==2) then
macros.run "PolyTools" "SpinEdge"
-- Flip face
else if (subobjectlevel==4) then
macros.run "Ribbon - Modeling" "FaceFlip"
---
I'm trying to work on a script that will consolidate all my views to 4 buttons (Pers/Orth, Top/Bottom, Front/Back, Left/Right). The idea is to be able to go from one view to another by toggling into another one. For example, in this script, I can go from any view to Top view, and if I want to enter Bottom view, I hit the button again.
if viewport.getType() != #view_top then
(viewport.setType #view_top)
else if viewport.getType() == #view_top then
(viewport.setType #view_bottom)
Although that code works, I'm having a problem with getting it to work with Pers/Orth. Here's the code I have so far:
if viewport.getType() != #view_pers_user then
(viewport.setType #view_persp_user)
else if viewport.getType() == #view_persp_user then
(viewport.setType #view_iso_user)
While this one does go from any orthographic view to Perspective, it doesn't seem to go back to an orthographic view when I run it again. I did make an alternative that works somewhat better (change in blue):
if viewport.getType() [COLOR=RoyalBlue][B]== #view_iso_user[/B][/COLOR] then
(viewport.setType #view_persp_user)
else if viewport.getType() == #view_persp_user then
(viewport.setType #view_iso_user)
While this does go back and forth between Orthographic and Perspective, obviously it doesn't go into Perspective if I'm in top/bottom/left/right view. I can't for the life of me figure out why the first one doesnt' works but this one does. If anyone has a solution for me, please let me know!
Replies
BAHAHAHA wow I'm an idiot. Well that does work! Thanks a lot! :thumbup: