1. Hey guyz. Welcome to the All New Phlatforum!



    Sign Up and take a look around. There are so many awesome new features.

    The Phlatforum is a place we can all hang out and

    have fun sharing our RC adventures!

  2. Dismiss Notice

[Plugin] RepairBL and Phlatten

Discussion in 'Other Sketchup related softwares/plugins' started by kyyu, Jan 19, 2010.

  1. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    I learning to write ruby script plugins. Mark said he always used the Repair Broken Lines and then right after did Phlatten. So here it is, a plugin that does both for you. It's nothing too complicated. I've always used macros to simply windows and windows programs (software called "Macro Express" is my favorite) and this would be the same type of thing but for customizing sketchup. By macro, I mean you aren't really writing new code, just automating stuff. For example, in windows if one found an internet gallery that he wanted to a copy of all the images. Where you don't have direct access of the file name, where you have to click to a new page for each image. Say for example there are 100 images. I have opted before to write a quick macro to click through and copy all the images automatically.

    Ok, back to the Plugin. You have to have "repair_broken_lines.rb" already installed. Repair Broken Lines plugin repairs by welding into one any line that is made of multiple colinear lines. If you don't have it download it here: http://www.crai.archi.fr/RubylibraryDep ... i_page.htm My plugin calls this plugin, and when you press ok to close the dialog box; then it automatically applies the Phlatscript Phlatten function. If you want to undo it (control-Z), you need to undo twice. Here it is. I've included a sketchup file, so you can easily test the plugin. -Kwok

    1) Original version. It's not documeted as such, but I will call it v1.0

    Here is an updated version, v1.1
    After finishing it, I realized that moving it up probably makes no difference. But who knows? So I have decided to release it, anyways. If nothing else, it will save an extra step for those that like to lift. There is a video of this version on post #25 viewtopic.php?f=103&t=1584&start=25#p15890

    2) v1.1




    -Kwok Attached files RepairBL and Phlatten plugin.zip (9.9 KB)Â RepairBL and Phlatten v1.1.zip (11 KB)Â
     
  2. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Your the man Kwok! :D Thank you for doing this, it will save us a lot of time in the long run and our designs will be much cleaner because of it.
    Thank you
    Mark
     
  3. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    You're welcome, Mark. If anyone has a request for an plugin, I may give it a shot if it's not too hard?

    -Kwok
     
  4. MartinT

    MartinT Member

    Offline
    Messages:
    109
    Trophy Points:
    18
    Thanks Kwok,
    But what changes/differences am I supposed to see when I "fix" your example file?

    Martin
     
  5. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Martin, I made a video to answer your question. I don't think the embedded viewer works, so just download the video. I'm just testing, as I normally would just upload this to a free file hosting site, like mediafire -Kwok

    Attached files RepairBL and Phlatten plugin (what it does).wmv (3.4 MB)Â
     
  6. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Great explanation Kwok thank you, this will be great for dxf imports!
    Looks like the wmv files are embedding fine too :)
    Mark
     
  7. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    They do embed, but I can't play them. When I hit the play button, nothing happens. Someone else was complaining about this, from a long time ago. Not sure if it ever worked for me, can't remember.

    -Kwok
     
  8. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Hum, I just checked the properties of that embedded player and it saids "Windows Media Player 10", so it could just be my old window's player. But I never intend to upgrade, any MS crap unless forced. The wmv files produced by FSCapture, I can't get audio to play on WP10 either. It's WMV2 audio, I believe. Tried to install a few versions of that codec and still doesn't work. But audio plays, with "windows player classic" and vlc player. Oh well, if others can view it then all is well. I don't mind downloading the video. I do that alot anyways, even when I can view them online.

    Oh, I am using FireFox, so it's not because I am still using IE6 :p

    -Kwok
     
  9. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
  10. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Yes, that's the exact classic player I use, just in a different form. The version, I have, is Quicktime Alternative. This I have been using forever, instead of installing "Apple Quicktime" to view .mov and .mp4. .mov is very common in video tutorials about 3d modeling/graphics. I guess because those guys us MACs. http://www.codecguide.com/about_qt.htm

    Vlc Player is the other player, I use, which can view almost everything without installing anything extra. I use this software to playing DVDs:
    http://www.videolan.org/vlc/index.html

    I still prefer to use Window Movie Player 10 to watch avi and wmv files, because the quality can be better. But I don't ever install any codec anymore. I just installed one thing, ffdshow, which is a DirectShow filter. Don't know what the difference is. But it can play most things, too. Even has a feature that improves the picture quality, in real time, while the avi movie is playing.
    http://sourceforge.net/projects/ffdshow-tryout/files/

    -Kwok
     
  11. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    You and I have almost identical setups! :)
    Mark
     
  12. MartinT

    MartinT Member

    Offline
    Messages:
    109
    Trophy Points:
    18
    Kwok, that was awesome, thank you very much for the visual explanation!

    Best regards,
    Martin
     
  13. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    You're Welcome, Martin.

    On another topic, I was finally able to get that very specific wma2 audio to play on Window Media Player 10. I found out that it's specifically Window Media Audio 9.1. Really strange because I have another video with WMA 9.0 and it plays fine. Well I googled WMA 9.1, and there was a forum discussion from 2007. And these guys couldn't get it to play, even after installing Window Media Player 11. Finally someone tried installing AC3 Filter ( http://ac3filter.net/ ) and that fixed it. Fixed it for someone else, too. I too, have installed it and my audio for the wmv movie made with FSCapture now plays on WMP10. Makes no sense, but there you have it.

    ps, don't ask me why wma 2 audio (as ID by the fourCC) is the same as WMA 9.1 It's just retarded. That's just my shorthand notation, as I am totally confused. But it now works.

    -Kwok
     
  14. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    Thanks for posting that vid Kwok. Because of this I now realize what the repair broken lines plugin does. I always wondered why it didn't work (I thought it was going to repair the stray lines) :lol:
    Cool mod to the plugins.
    I think it's great your learning the ruby language.
     
  15. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Hot dam, Kwok. I too just realized what the script was for. I never used it because I didn't know what it was good for. Now I know. Thanks.
     
  16. 7up

    7up Moderator Staff Member

    Offline
    Messages:
    1,090
    Trophy Points:
    38
    Location:
    Kentucky
  17. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Glad you guys, got something out of it. Videos seen to add so much to the learning process. There's sure to be more plugins to come. Got a few ideas already. One I am thinking about, is a rotate 90 deg which works off the keyboard arrow keys. -Kwok :D
     
  18. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    I just installed Internet Explorer 8 and now I can finally view the video! :D Even fixed it in Firefox!
     
  19. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
  20. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Kwok that is cool! You are really getting this Ruby stuff..:D
    What are your plans for this plugin once complete?
    Very cool keep up the good work looking forward to giving it a try
    Mark
     
  21. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    That is cool Kwok. Good job! Do you have it so it's working only on groups and components?
     
  22. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    To tell you the truth, I don't understand half of what is going on in that plugin. The basic structure I think I understand 70%, so it's not too hard to do if based on someone else's work. I've done alot of research and collected examples, but finally I found this plugin called Rotix which does close to what I wanted. This plugin is mostly based on it, version1.0 not 1.1. You can download it at the Ruby Depot. But at the line and word level, my understanding is pretty bad, I say only 30-40%. I don't really want to release too much, until I have a better understanding and also not cause problems for other plugins. Also, the headache of version control when you don't know how to do that, either. What I could do right away is, release an encrypted version of this plugin for people to try out and give feedback? Then I wouldn't have to worry too much about plugin version, polishing up the code, and stuff like finishing the credits. Actually I like that idea. I'll go ahead an do that, a little later.

    Right now, 1) I am mainly doing plugins for my own use. I got this problem with my right index finger going numb, if abused. Probably from a few years of drawing cad at a old job. So I like to automate things, when possible, especially right mouse click. 2) Also would be nice to have a set of tools, to make drawing planes alot easier. Might help the beginners get started, too.

    3DMON, yes it only picks groups and components. That's just how it was already set up in the original code.

    -Kwok
     
  23. Anonymous

    Anonymous New Member

    Offline
    Messages:
    1,280
    Trophy Points:
    0
  24. 7up

    7up Moderator Staff Member

    Offline
    Messages:
    1,090
    Trophy Points:
    38
    Location:
    Kentucky
    Nice work Kwok. You're probably rounding your learning curve the best way possible, by using other plugins as examples. If I were to try and learn Ruby I believe I'd take the same route that you are traveling. Keep it up!
     
  25. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    @Dorsal, My friend has one of those trackball, but I can't use it. My brain just doesn't work with it. Also seemed very slow and not precise, compared to a mouse. Anyways, the finger thing isn't a too bad these days. But I still make an effort to minimize it, if I can.

    @7up, the more the merrier. Maybe if more people become interested, we can start a Ruby Forum.

    Ok, here is the plugin. This is the same info as in the included text file:

    Get the plugin here. Now called "Key Rotate": http://www.phlatforum.com/viewtopic.php ... 646#p16223
     

Share This Page