ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Any GOOD dxf writing guides? (Autodesk seems dead)

    4
    0 Votes
    4 Posts
    709 Views
    dereiD
    @tig said: Googling 'dxf reference guide' return lots of interesting hits - e.g. http://www.autodesk.com/techpubs/autocad/acadr14/dxf/dxf_reference.htm Also there are several RB file plugins in the PluginStore which do DXF import/export manipulation - so using those as 'cribs' would help too... So what more do you want ? Thanks for this... i did a lot of search, but I guess I used the wrong keywords ) never found this. Thanks a lot.
  • Load classification system via ruby code

    18
    0 Votes
    18 Posts
    2k Views
    tt_suT
    @blruuska said: Dan, Thanks for verifying. It is surprising that NotImplementedError wasn't raised, if that is the case here. Ackh! Yea, something is amiss here. Not sure if we intended to support enumeration type in the initial release of the API - but if that's the cause it should have been NotImplemented. However, I might confuse this with the "choice" type. Maybe something changed in the last moment. I need to investigate.
  • Adding two Point3d, is that impossible?

    11
    0 Votes
    11 Posts
    912 Views
    Dan RathbunD
    @dan rathbun said: @ziocleto said: The strong typization of Point3d and Vector3d is also very questionable as ... And this why the SketchUp API authors made both classes "compatible" with a basic 3 element array, ... OH.. also.. there is another way they could have gone for this particular method. And that is duck-typing the argument, instead of class-typing it. Ruby example (they are really implemented on the C-side): <span class="syntaxdefault">def </span><span class="syntaxkeyword">+(</span><span class="syntaxdefault">arg</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  raise</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">TypeError</span><span class="syntaxkeyword">,</span><span class="syntaxstring">"invalid&nbsp;argument&nbsp;type"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">caller</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> unless<br />  </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">x</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">y</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">z</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||<br /></span><span class="syntaxdefault">  </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;[])</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> </span><span class="syntaxcomment"># be sure it has 3 members<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">2</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxcomment"># rescue modifiers trap IndexError exceptions<br /><br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># the method body<br /><br /></span><span class="syntaxdefault">end</span> If you are only concerned with Ruby 2.0+, then you can use a refinement module to correct the method for you code only.
  • Deleting an Edge knowing 2 points

    4
    0 Votes
    4 Posts
    339 Views
    K
    Thanks TIG and Dan I applied the code to the Tails part of my Dovetail Tool and now the result is a part with tails that is still a solid. No left over edges or faces. The strange thing was that when selecting the component edges if you selected them clockwise (edge1 to edge2) the part was clean but selecting in a counter clockwise direction there were left over faces. Now thanks to your help edge selection direction works either way. Thanks Keith
  • Fails succeeds fails......

    6
    0 Votes
    6 Posts
    370 Views
    sdmitchS
    @tig said: I don't have time to dissect your code in detail... But it seems to me you are replicating my Latticeizer plugin ? Look at that... http://sketchucation.com/pluginstore?pln=Latticeizer You need to offset the perimeters of the edges' faces [which sometimes fails, just like native-offset - so it perhaps needs my Smart_Offset?] It's NOT easy... Don't waste your time dissecting it since this is a just for fun exercise. I have found a number of bugs but have a few more to go. I have no intention of publishing it since, as you say, there is Latticeizer and others already out there.
  • Return values from ruby system calls

    3
    0 Votes
    3 Posts
    573 Views
    Dan RathbunD
    SketchUp 2014 was bugged in this regard. The workaround was to pipe to a text file, I think. I think it was fixed in SketchUp 2015. I recall having written a patch script that overrode the Kernel.backquote method. (I have to have a look for it.)
  • Load a vismat / vray material into sketchup??

    2
    0 Votes
    2 Posts
    378 Views
    Dan RathbunD
    A good question for: http://forums.chaosgroup.com/
  • Textures in model slow down ruby?

    10
    0 Votes
    10 Posts
    516 Views
    Dan RathbunD
    @wawmsey7 said: However it would be easier if I could have code before the code for loading the component to check if it's already loaded or not into the model and then load it if it's not already there? Is that do-able? You need to search the DefinitionList collection properly. This class, like many of the API collection classes, has the Enumerable library module mixed in. The following method should be wrapped within your plugin module: def self.get_component( filepath = "some/path/to/component.skp" ) # Warning, on MS Windows the definition paths are # returned with backslashes not forward slashes ! filepath = filepath.tr("\\",'/') dlist = Sketchup.active_model.definitions found = dlist.find {|cdef| if cdef.path.nil? false elsif cdef.path.tr("\\",'/') == filepath true else false end } return found if found if File.exist?(filepath) dlist.load(filepath) else return false end end
  • State of Observers ?

    2
    0 Votes
    2 Posts
    293 Views
    Dan RathbunD
    @oajfh said: ...Tool Observer (OnButtonUp and OnButtonDown) ... There is not a ToolObserver class in the API. The onButton.. callbacks are part of the abstract Tool class, not an observer class. @oajfh said: ... and an EntityObserver (OnEntityChange), ... Write a quick test observer and see if it fires when you move an object. @oajfh said: Does this seem like the most natural way to you ? Are there any latent bugs (seems like Observers have had problems in past versions, I can't seem to find more recent information) or potential problems to this approach (I've read up on a few common pitfalls but don't know much more) ? Welcome the foggy world of SketchUp API Dcoumentation. Where nothing is really certain, and all are kept in limbo.
  • [Suggestion] Web Exporter 2?

    15
    0 Votes
    15 Posts
    2k Views
    A
    hello all, i'm looking for a plugin or extension that make rotation of the object, for example any 15 degrees each, to create sprites for games or visualization. i've found web exporter beta but i'm not able to found the download link, no in extension warehouse nor plugin store. please let me some suggestions! many thanks Akira
  • Associating data structures with save

    11
    0 Votes
    11 Posts
    632 Views
    Dan RathbunD
    @devinlange said: At the very least if the user modifies the faces I don't want anything to fail. This will be difficult. As faces get modified, or new edges intersect with them, they get split up into multiple faces, and sometimes get new object ids. Myself, I'd never rely on "setting" a path of primitives, and expecting the path of them to survive. Instead I'd create a virtual path. Could be a series of Guidelines (Construction lines) in a special group. Or actually maybe a Curve (which is SketchUp's name for a series of edges connected end to end,) within a group context, and on a "path" layer that can be turned off. The path and it's group can also be locked. You could associate the vertices of the path with one of the vertices of a face. Later on when you need to "follow the path" you iterate the Curve's collection of vertices, and use a PickHelper object to find the face under the current vertex. Push the face reference into an array, and repeat. Just thinking out loud.
  • Detect if cpoint is clicked

    6
    0 Votes
    6 Posts
    414 Views
    Dan RathbunD
    @maricanis said: I was concerned what would happen if user select other Scene for example while tool is active, ... I believe the active_view is a singleton object of the model. (there is only one.) The user sees scene pages through the active_view.
  • Revert back to saved version

    8
    0 Votes
    8 Posts
    4k Views
    TIGT
    Going back several steps .move! works like .transform! without affecting the stack within an animation ?
  • Vertex Normals... ?

    26
    0 Votes
    26 Posts
    2k Views
    Dan RathbunD
    @oajfh said: Sorry for dragging this topic on for so long. Don't worry about it. This is the kind of nitty-gritty dirty details us consummate geeks really love to ponder.
  • Best practice for followme

    2
    0 Votes
    2 Posts
    290 Views
    sdmitchS
    Put the face in a group the do the followme. Everything created by the followme will be added to that group myGroup = Sketchup.active_model.entities.add_group myFace status = myFace.followme(lines) Then you can move the group.
  • Group moves far away when i want to scale

    4
    0 Votes
    4 Posts
    391 Views
    tt_suT
    @youngosg said: t = Geom::Transformation.scaling 2 There is an issue with this method - it doesn't produce the same transformation as Geom::Transformation.scaling(2, 2, 2) The former change the 16th value in the matrix - instead of scaling the components. I'm not sure why it was implemented as such, but several render engines have had issues with that. I think even SU have issues in some cases. Think we have an issue filed to change it.
  • Executing one call_back executes another.

    12
    0 Votes
    12 Posts
    589 Views
    thomthomT
    That would do the same thing - the <form> element usually have the URL to which to submit to. Without a parent <form> the submit button had no default action.
  • Using add_line to automatically create a new face

    6
    0 Votes
    6 Posts
    582 Views
    Z
    Thanks I've missed that edge.find_faces, it works great. I think the naming put me off as I wasn't expecting that it will also add faces, I just thought it was going to find potential faces, I think it should may be renamed: find_and_add_faces just for clarity.
  • Correction of codes

    4
    0 Votes
    4 Posts
    366 Views
    K
    Thanks, sdmitch and slbaumgartner. Now It works well However, I'm planning to create some shapes more with this way and actually made few shapes. I'm worrying about increase of icons in Sketchup, and am making ideas how to simplify tools. Making dialog box I saw some free tools which 'inputbox' is added together. If the shapes can be individually selected in inputbox, I need not add icons anymore, but don't know how to make it. I know basic codes for creating inputbox, and would like to apply the basic code to what I want(choosing each shapes individually in inputbox). Additionally, Is it possible to add shapes which are saved in .skp file(I know how to load shapes saved in .skp file by using 'Class' method and how to place it on Sketchup space clicking) into inputbox too? Using webdialog If i create webdialog box and add all icons into the webdialog by making tables(categorization), This way may look good as well. I'm trying to use dlg.add_action_callback("") {|d, p|Sketchup.send_action ""} Can i utilize this command for making icons in webdialog? I mean, the command looked like only basic tools(Undo, Redo, New, Cut, PushPull) can be used with the command. For example dlg.add_action_callback("Undo") {|d, p|Sketchup.send_action "editUndo:"} dlg.add_action_callback("Redo") {|d, p|Sketchup.send_action "editRedo:"} dlg.add_action_callback("New") {|d, p|Sketchup.send_action 57600} dlg.add_action_callback("Open") {|d, p|Sketchup.send_action 57601} dlg.add_action_callback("Save") {|d, p|Sketchup.send_action 57603} As you know, these actions are used in HTML and '<scrip> </script>' connects between ruby codes and HTML codes for indicating icons in webdialog. How can I make my own Sketchup.send_action? If it is possible, I will add the icons into webdialog.
  • To Convert Sketchup Points to CNC G-Code

    2
    0 Votes
    2 Posts
    2k Views
    Dan RathbunD
    Someone started a project but needs someone else to finish it: Model2GCode - who would like to continue? Other projects: [PlugIn] 3D Printers G-Code importer/Exporter Ver0.0.9 [Plugin] 2.5D CAM Plugin 20121202 [Plugin] Another g-code export

Advertisement