sketchucation logo sketchucation
    • Login
    1. Home
    2. Frankn
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 26
    • Posts 103
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Trouble understanding how Dynamic Components are created

      Hi Chris,

      @chris fullmer said:

      Well then, the bigger question is does you component need to be compatible with the built in dynamic component webdialog, like for others to interact with it.

      I didn't think of that since I assumed the way of doing this was through Dynamic Components. 😳 So I'm not sure what being compatible with implies the DC webdialog implies either way.

      @unknownuser said:

      There is no need to actually make a "dynamic component" to do what you are asking. There is a lot that goes on behind the scenes of dynamic components. If all you want to do is manipulate components using your own webdialog, I'd recommend not using the term dynamic component a that confuses the question with the actual dynamic components.

      Gotcha, knowing that now, yes that's exactly what I'd like to do is being able to manipulate the created components. eg: height, width, depth... along with other variables I have. And being able to do so to all the components or just selected ones.

      @unknownuser said:

      The way I see it is that you have 2 main issues to tackle here.

      1 - You need to learn how to work with components, and scale them or manipulate their geometry. You can learn this without the trouble of a webdiloag first.

      I have a pretty good handle on creating components already but manipulating tham after they've been created is another story which is what my original question should of been. πŸ˜•

      @unknownuser said:

      2 - You need to master is how to converse freely back and forth from ruby and your web dialog. Once you get them talking, and you know what you need to do to your components, then its easier to understand how to put your webdialog together so it can reach into the model and make changes.

      I've got the initial communication between WD and ruby working just fine. Actually My plugin is built with WD and also works great, well it needs a few 'fixes' but I'm able to get all that done, as best as I can for a newbie at lest. πŸ˜‰ But getting my WD to then modify or manipulate as you say the components I create is a whole other story! I fugured integrating DCs was the way to go but seems like there are other ways of doing so.

      That being said, from your reply maybe I should look into scaling my components? Or resending new values and some how applying them to existing components and redrawing? Am I even close in my assumptions? πŸ˜• πŸ˜†

      Thanks,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: Trouble understanding how Dynamic Components are created

      Thanks for the reply Pilou. And yes I could use the built in DC but I'd like to mimic the same thing in my plug in using ruby. For a couple if reasons, one it would be more convenient and also it gives me something new to try and learn. It might seem a little masochist but for me it's almost like therapy πŸ˜„.

      posted in Developers' Forum
      F
      Frankn
    • Trouble understanding how Dynamic Components are created

      Hi everyone,

      As the title says I just can't understand how to get DCs work. I've searched and read everything I could find but I just can't figure it out!

      Here's a quick and simple example of what I'd ultimatly like to accomplish with DCs and webdialog...

      I have a webdialog that creates a cube by entering the following info... height, width and depth, works fine. Now I'd like to be able to modify the cube I created from within my webdialog. eg: I create a cube that is 10h x 10w x 10d and would like to change the height to 20, making it 20h x 10w x 10d. Also I'd like to be able to do that to all the cubes created or just certain ones that I select.

      I'm thinking I would need 2 buttons/fucntions to get this done, one 'build' button and one 'modify' button.

      Can anyone give me a simple example I can go by or even tell me of a relatively simple plugin that uses DCs?

      Thanks in advance for any help.
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: Changing cursor insertion point on bounding box

      Thanks TIG, I haven't gotten around to trying what you suggested but I will soon enough. πŸ˜„

      posted in Developers' Forum
      F
      Frankn
    • RE: Changing cursor insertion point on bounding box

      Hi TIG,

      I tried your suggestions and get the same result. After my plugin builds the component. I select where I'd like to insert into the model but the insertion point remains as the bottom left front corner... aftewrwards if I select compoents from the component browser then it modifies the insertion point to corner(6).

      Should I be applying these changes outside the def onLButtonDown method? I'm trying that but with no luck so far...

      Thanks TIG.

      posted in Developers' Forum
      F
      Frankn
    • RE: Changing cursor insertion point on bounding box

      Ok I found my problem... it was in part of the code I was using from the example found here... https://developers.google.com/sketchup/docs/ourdoc/boundingbox

      I forgot to change bbox = model.bounds to boundingbox=defintion.bounds. πŸ‘Š 😳

      So now I get the correct Point3D output... BUT... now I have a problem with this line...

      instance=model.active_entities.add_instance(definition, new_insertion_point)
      

      Which is what I'm using to add the component to the model when left clicking where I want to place it. So let's say I have a component that is (10, 1, 10) it inserts it at Point3d(0, 1, 10). Afterwards if I get the compoent from the compoent window the cursor selects the component at the correct bunding box corner.

      Basically it's not setting the bounding box insertion location it's using the new_insertion_point as coordinates to insert the component... I think, right??

      Getting a little closer. πŸ˜„

      p.s. sorry if I'm not using the terms instance and defintion correctly, I'm still a little confused by how that works. πŸ˜•

      posted in Developers' Forum
      F
      Frankn
    • RE: Changing cursor insertion point on bounding box

      Ok so I've been looking at those 2 plugins and here's the problem(s) I'm having...

      The plugin from Sahi somewhat does what I'd like to do BUT you need to select an instance first and then when adding a new instance of the component it changes the input point... I want to change the input point after the defintion has been created and before inserting the instance into the model.

      The plugin from thomthom does exactly what I'd like to replicate (minus the input box) but to be honest his programming skills are way over my head when using TTlib2/core.rb. I'm having a hard time following along with what is being done. 😳

      So basically I'm stuck somewhere in the middle of the 2. πŸ˜„

      Here's what I get in Ruby Console as an output, Point3d(1e+030, 1e+030, 1e+030). I can't associate the bounding box corner() to Sketchup::ComponentDefinition:0xb93d2fc.

      Here's the code I've been testing with which returns Point3d(1e+030, 1e+030, 1e+030)...

      corner=boundingbox.corner(6)
      back_top_corner=Geom;;Point3d.new(corner)
      new_insertion_point=definition.insertion_point=back_top_corner
      
      

      So close yet so far... πŸ˜•

      posted in Developers' Forum
      F
      Frankn
    • RE: Changing cursor insertion point on bounding box

      @dan rathbun said:

      See also: [ruby-doc] ComponentDefinition.insertion_point=

      Ok here's the plugin I was thinking of:
      [Plugin] Axis components (Sahi)

      There's also:

      [Plugin] Axes Tools (ThomThom)


      One of the best ways to learn, is to see how others have done similar things.

      Thanks I was just searching for siaNYC and wasn't coming up with anything and I totally agree that seeing how others did something is a great way to learn... let's just say I've copied and pasted plenty of code from other plugins trying to learn and make it do what I wanted. πŸ˜„

      Thanks for the links... I'll be checking those out right now.

      posted in Developers' Forum
      F
      Frankn
    • Changing cursor insertion point on bounding box

      Hi All,
      The default cursor insertion point of a component is the front lower left corner and I'm able to use that to determine where to place components from my plugin but I'd like to change it to some other point. I'm pretty sure I need to combine InputPoint and BoundingBox but I can't figure out how to do so... the only thing my searches came up with is this post... http://forums.sketchucation.com/viewtopic.php?f=180&t=33428&p=294834&hilit=bounding+box+cursor#p294834
      thomthom seems to be asking if it's possible to do so through the API but no answer was given.

      As a reference I'm playing around with the TrackMouseTool which is located in the utilities.rb file and also found this post http://forums.sketchucation.com/viewtopic.php?f=180&t=35353 which has some good info on mouse tracking.

      As always thank you for your time,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: Naming components

      Thanks for the link Dan... that's the kind of info that seems trivial till you run into a problem. πŸ˜„

      Yeah Komodo does all that good stuff plus the pro version does a bunch of other stuff and even debugging for ruby, I think. But I tried it and it had too many bells and whistles for a newbie like me and was confusing!

      posted in Developers' Forum
      F
      Frankn
    • RE: Naming components

      I knew that model.place_component was too good to be true! πŸ˜„

      @tig said:

      Use add_instance and then if you want the instance [ dins] to be movable thereafter you can write your code as a 'Tool' class and then have the transformation of din reset dynamically to always be at the cursor's point, and when you left-click the mouse it'd set dins's transformation to be at the clicked point...
      BUT perhaps that is too complex for now πŸ˜•

      Ok, I have no idea what all that means but I'm game to learn it! Could you point me in the right direction? Maye a plugin that already does something similiar or a code snippet to get me started?

      Thanks for the help TIG!

      posted in Developers' Forum
      F
      Frankn
    • RE: Naming components

      @tig said:

      The code I offered you was simply a corrected version of yours.
      If you were then to add an instance of 'defn' it would obviously display that component's definitions name [all instances of that definition will!]... However, an instance will not have a name, because by default a new instance does not have a name.
      Of course you could give that instance any name you like... perhaps using 'name'...
      πŸ˜•

      Ok so far I understand that logic and I'm aslo able to put it onto practice... except for the part I highligthed in bold... which correctly explains what I'm not able to do. I don't get where I should add the 'name' part. the only way I can think of is by

      defn_new=entities.add_instance defn, [0, 0, 0]
      

      but I get a double occurance error. And everything else I've tried will change the defintion name and not add an instance name.

      Perhaps it's in how I add the instance of defn to the model that is the problem(I hope I'm using the correct term, still a little confused)?...

      status=model.place_component(defn)
      
      posted in Developers' Forum
      F
      Frankn
    • RE: Naming components

      Thanks for the replies.

      Sorry for using def as a reference, I'm not using that in my plugin code it was just as an example... though I didn't know not to use it... learn something new everyday. πŸ˜„ I got used to komodo edit for some reason even though seems like Notepad ++ is what most use.

      Now, that being said... Dan you're 100% correct I'm totally confused 😳 πŸ˜„ . And I'll have to reread your post a few times to get it straight, thanks for taking the time to explain the differences in detail.

      TIG, using your code I get the same result as I am now. Which is my parent component has a definition name but no name and the child component has both. I know I'm probably not explain what I'm trying to do properly since as already stated I'm confused. πŸ˜• πŸ˜†

      Here's something I found that resembles what I want to do other then I'm not working with groups...

      From a post by ThomThom, here...
      http://forums.sketchucation.com/viewtopic.php?f=180&t=23567

      group = model.active_entities.add_group(sel)
            name = model.definitions.unique_name(input[0])
            # We set the name we will see in the Entities window.
            group.name = name
            # We set the definition name as well. If you convert the group to a component, this is the
            # name it will get.
            group.entities.parent.name = name
      
      

      And also from TIG, here...
      http://forums.sketchucation.com/viewtopic.php?f=180&t=23311

      instance=group.to_component
      definition=instance.definition
      definition.name="My Definition's Name"
      instance.name="My Instance's Name"
      
      

      Hope that helps making what I'm trying to do clearer...
      Thanks,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • Naming components

      I'm having a problem with a seemingly simple task. how can I add both a Name and Defintion Name to a component that contains subcomponents?

      I can add both to an instance of the subcomponents without a problem but I can only manage to add the Defintion Name to the parent component.

      I've read and searched but can't find a solution. 😳

      
      def=model.definitions.add @name + " (test def)" 
      entities=def.entities
      
      ins=entities.add_instance @def_test, [0, 0, 0]
      name=ins.name=@name + " (test ins)"
      
      

      Thanks,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: Help needed to test cabinet plugin

      Hi Keith,

      Thanks for the input.

      As stated some features aren't working yet... as you found out right now you can't mix and match doors and drawers. πŸ˜„ 😳

      Which in turn is why you're not asked anything about drawer size... when adding drawers to base cabinets they automatically divided equally in the size of the cabinet entered. Ecepth when selecting 3 drawers then the top is smaller then the bottom 2... I'll be adding the option to have 3 equally sized drawers.

      Like I said this was for personal use with the way I build cabinets so I understand that some deatures seem limited... but I figured it was hard enough to get what I wanted without adding options I would never use. πŸ˜„ But I'm kinda getting the hang of this and add different features as I go along and have the time. So far it's proven very useful in getting exact measurements for things like stile and rails which I use to have to calculate individually for different cabinets, now it's all done automatically which to me is a huge time saver.

      As per Dan's suggestions I'm working 'standardizing' the pluggin and when I'm done with that I'll start a new thread dedicated to the plugin with updated. I guess till then this thread can be used for suggestions.

      Frank

      @ktkoh said:

      Tested your cabinet plug-in and was impressed. However I was trying to design a base cabinet with 2 drawers at the top and then doors on the lower part of the cabinet. What I got was a 30" tall base cabinet with 2 doors and then 2 drawers on top of the base cabinet with a total height of about 50". Also when I specified drawers I was not asked anything about size. I'm sure there are too many options to please all cabinet designs but I would think this would be able to get a kitchen design started and the individual could add/change some details with less work than starting from scratch.

      Keith

      posted in Developers' Forum
      F
      Frankn
    • RE: Help needed to test cabinet plugin

      Just noticed after replying that this has been moved to the developer forum... thanks to whoever did that. πŸ˜„

      Note to the guru developers in here... please be getntle with me... 😳 πŸ˜„ but I do look forward to your input.

      This is an alpha or beta or whatever non finsihed version and is just a fun/past time thing for me but any improvements I can make or anything I can learn that I'm doing wrong is welcomed. πŸ˜„

      Thanks in advance,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: Help needed to test cabinet plugin

      Thanks John,

      I've asked for help a few times in the developers forum and those guys are great with the help they offer. I'll post the plugin there also get they're feedback but again this is a first for me and I don't want to be a bother to those guys with something which seems so basic to some of the stuff they do. 😳

      Here's the plugin, sorry I thought I had attached it... like I said this is just for fun and not all the options/funstions are working yet but I'd really like to get some feedback from fellow woodworkers.

      So please go ahead and tell me what you think and features you think would be helpful or need to be changed improved. And also some of the terminology is probably not the best so feel free to give me suggestions/corrections. πŸ˜„ This was never meant for others and uses building technique I use to go along with the sheet stock I use for building cabinets, which is 30 x 60 Russian Birch plywood.

      Thanks in advance πŸ˜„
      Frank

      posted in Developers' Forum
      F
      Frankn
    • Help needed to test cabinet plugin

      Hi,

      I'm working on a plugin that creates kitchen cabinets and I was wondering if anyone would like to test it out for me and give me their comments as to what could be added , changed or improved. I'm no ruby plugin expert, this is my first attemp at making a plugin so it's more of a learning exercise and it's not complete but it does what I need it to do so far.

      So any takers? πŸ˜„

      Thanks,
      Frank

      posted in Developers' Forum
      F
      Frankn
    • RE: What am I doing wrong?

      Trust me Chris you and everyone else who takes the time to help us new guys out are anything but useless. πŸ˜„

      @chris fullmer said:

      Sorry we were so useless. Glad you figured it out, though!

      posted in Developers' Forum
      F
      Frankn
    • RE: What am I doing wrong?

      With some trial and lots of errors I figured it out. πŸ˜„

      posted in Developers' Forum
      F
      Frankn
    • 1 / 1