Sketchucation Tools 5.0.7 | Licensing improvements and bug fixes Learn More

Alkategóriák

  • No decscription available

    20 Témakörök
    462 Hozzászólások
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Special Characters in ENV[APPDATA] not recognized

    6
    0 Szavazatok
    6 Hozzászólások
    485 Megtekintések
    AdamBA
    The only way around this I found was to write all my own Filepath handling in C++ for LightUp so handling Kanji, etc etc all works correctly.
  • Pushpull makes google 8 to crash

    4
    0 Szavazatok
    4 Hozzászólások
    342 Megtekintések
    TIGT
    Here's a version that works, with undo, and a menu etc... require 'sketchup.rb' module PorteBuilder class Porte attr_accessor ;espaceBas, ;espaceHaut, ;espaceCote, ;charniereEspaceBas, ;charniereEspaceHaut, ;poigneeEspaceBas, ;hauteur, ;largeur, ;epaisseur, ;frontFace def initialize(espaceBas, espaceHaut, espaceCote, charniereEspaceHaut, charniereEspaceBas, poigneeEspaceBas, hauteur, largeur, epaisseur) @espaceBas = espaceBas @espaceHaut = espaceHaut @espaceCote = espaceCote @charniereEspaceHaut = charniereEspaceHaut @charniereEspaceBas = charniereEspaceBas @poigneeEspaceBas = poigneeEspaceBas @hauteur = hauteur @largeur = largeur @epaisseur = epaisseur end # initialize def draw() model = Sketchup.active_model entities = model.entities group = entities.add_group() entities = group.entities # dessiner la base de la porte basePts = [] basePts[0] = [0, 0, @espaceBas] basePts[1] = [@largeur, 0, @espaceBas] basePts[2] = [@largeur, @epaisseur, @espaceBas] basePts[3] = [0, @epaisseur, @espaceBas] base = entities.add_face(basePts) @hauteur = -@hauteur if( base.normal.dot(Z_AXIS) < 0 ) # faire une porte avec la base array_before = entities.to_a base.pushpull(@hauteur) array_after = entities.to_a new_entities = array_after - array_before # aller chercher la face qui aura la poignée new_entities.grep(Sketchup;;Face).each{|face| resultClassify = face.classify_point(basePts[0]) if (face.normal.parallel?(Y_AXIS) && resultClassify == Sketchup;;Face;;PointOnVertex) @frontFace = face break end } # bâtir le trou de la poignee rayonPoignee = 1.25.inch posXPoignee = @largeur - 2.0375.inch - rayonPoignee posYPoignee = 0 posZPoignee = @poigneeEspaceBas + @espaceBas centrePoignee = Geom;;Point3d.new(posXPoignee, posYPoignee, posZPoignee) # décider de la normal de la poignee edgesPoignee = entities.add_circle(centrePoignee, Y_AXIS, rayonPoignee) facePognee = ( edgesPoignee[0].faces - [@frontFace] )[0] facePognee.pushpull(-@epaisseur) end # draw end # class Porte class Moulure largeur = 3.75.inch epaisseur = 0.75.inch end # class Moulure class Montant attr_accessor ;largeur, ;epaisseur def initialize(largeur, epaisseur) model = Sketchup.active_model entities = model.entities group=entities.add_group() @entities=group.entities @largeur = largeur @epaisseur = epaisseur end # initialize def draw(porte) normalFrontFace = porte.frontFace.normal nearestPoint=nil porte.frontFace.edges.each{|edgeFrontFace| linesPoint3d=[] edgeFrontFace.line.each{|e| linesPoint3d<<e if e.class==Geom;;Point3d } linesPoint3d.each{|linePoint3d| point = ORIGIN.clone if nearestPoint == nil || linePoint3d.distance(point) < nearestPoint.distance(point) nearestPoint = linePoint3d end } } startingPoint = nearestPoint.offset [-porte.espaceCote-@epaisseur, 0, porte.hauteur+porte.espaceHaut] drawPart(startingPoint, @epaisseur*2+porte.largeur+porte.espaceCote*2, @largeur, @epaisseur) startingPoint = nearestPoint.offset [-porte.espaceCote-@epaisseur, 0, -porte.espaceBas] drawPart(startingPoint, @epaisseur, @largeur, porte.espaceBas+porte.hauteur+porte.espaceHaut) startingPoint = nearestPoint.offset [porte.largeur+porte.espaceCote, 0, -porte.espaceBas] drawPart(startingPoint, @epaisseur, @largeur, porte.espaceBas+porte.hauteur+porte.espaceHaut) end # draw def drawPart(startingPoint, offsetX, offsetY, hauteur) begin basePts=[] basePts[0] = startingPoint basePts[1] = basePts[0].offset [offsetX, 0, 0] basePts[2] = basePts[1].offset [0, offsetY, 0] basePts[3] = basePts[2].offset [-offsetX, 0, 0] base = @entities.add_face(basePts) if base.normal.dot(Z_AXIS) < 0 base.pushpull(-hauteur + 0.03125.inch) else base.pushpull(hauteur) end rescue puts $!, $@ end end # drawPart end # class Montant def self.dialog() prombasePts = ["Hauteur?", "Largeur?", "Profondeur"] values = [80.0.inch, 30.0.inch, 1.875.inch] results = inputbox(prombasePts, values, "Dimension de votre porte ?") return unless results # This means that the user canceld the operation height, width, depth = results Sketchup.active_model.start_operation('PorteBuilder') #espaceBas, espaceHaut, espaceCote, charniereEspaceHaut, charniereEspaceBas, poigneeEspaceBas, hauteur, largeur, epaisseur) unePorte = PorteBuilder;;Porte.new(0.75.inch, 0.0625.inch, 0.0625.inch, 7.0.inch, 11.0.inch, 36.0.inch, height, width, depth) unePorte.draw() lesMontant = PorteBuilder;;Montant.new(3.5.inch, 0.75.inch) lesMontant.draw(unePorte) Sketchup.active_model.commit_operation end UI.menu("Plugins").add_item('PorteBuilder'){self.dialog()} unless file_loaded?('PorteBuilder') file_loaded('PorteBuilder') end # module PorteBuilder I'm unsure of the exact issue. Your code seems more complex than it needs to be Why not draw the vertical face for the inverted U of the door-frame and pushpull that inside a door-frame-group, then draw the vertical face of the door-leaf and pushpull that inside a door-leaf-group, with the hole punched out for the ironmongery ? That way you control the face orientation - the counter-clockwise points around a face loop determine its normal vector. If you want door-stops add those inside a door-stop-group, in a manner similar to the frame itself: it can be inside the frame group too. You really don't need so many classes as a range of methods self.xxx() would do whatever you want with in the module, and using @xxx variables would make them available across the module too...
  • Intersection - Problem with coplanar cuts

    5
    0 Szavazatok
    5 Hozzászólások
    555 Megtekintések
    TIGT
    You could try the first argument (recurse) of .intersect_with() method set as 'true'. Also you can include more than one 'entity' in the method's final argument (entities2) - passed as an array of entities... Say [g1, g2] or even [g1.entities.to_a, g2.entities.to_a].flatten
  • X-ray transparency settings?

    5
    0 Szavazatok
    5 Hozzászólások
    2k Megtekintések
    TIGT
    You can only get/set and toggle Xray-mode on/off using: Sketchup.active_model.rendering_options["ModelTransparency"] Sketchup.active_model.rendering_options["ModelTransparency"]=true Sketchup.active_model.rendering_options["ModelTransparency"]=false The amount of Xray-mode's 'opacity' is 'hard-coded' Fredo has made a pseudo Xray-mode tool [can't recall it's name off-hand ], which works on selected objects, but that just swaps to similar but translucent materials [you could customize the amount of transparency in it] - so although it mimics Xray for parts of the model, it is only useful 'graphically' in images - there are none of the Xray-mode's advantages - like being able to pick 'through' intervening faces etc...
  • Class installs twice when reloaded!

    14
    0 Szavazatok
    14 Hozzászólások
    939 Megtekintések
    onidarbeO
    aoh, I need to have that file Win32API.so in the plugin map! thanks
  • Web dialog fractions conversion

    8
    0 Szavazatok
    8 Hozzászólások
    562 Megtekintések
    Dan RathbunD
    @garry k said: This is NOT as expected - regardless. I know myself that I work mostly in millimeters but feel quite at home going back and forth. All the other built in conversions work just fine. Just not this one. Yes I think it IS a bug. Today I tested with a model set to decimal feet (0.001) and got this: ` '2 1/2"'.to_l 30.0 Sketchup::format_length('2 1/2"'.to_l) 2.500'` So the inch symbol is ignored. But in a model set to inches: "2.54'".to_l %(#008000)[30.48] So it seems the foot symbol works, IF the numeric is decimal. But IF it is fractional (model set to inches): "2 1/2'".to_l %(#008000)[24.0] **So I agree. It is a bug issue with fractional expressions. ADD: The error also occurs within the VCB (Measurements Box) !**
  • How can I run code on view-change

    8
    0 Szavazatok
    8 Hozzászólások
    644 Megtekintések
    onidarbeO
    thanks!
  • Erase Selection from within any plugin (VK_DELETE)

    2
    0 Szavazatok
    2 Hozzászólások
    302 Megtekintések
    Dan RathbunD
    @fredo6 said: The Selection observers remain completely silent about the erasing of the current selection. No event is fired. Not true... they are calling misspelled callbacks. To see what the SkecthUp engine wants to call (even tho the spelling is a bug,) ... override the respond_to?() method in your observer subclass, (being sure to pass the arg on to super,) but puts'ing the method name to STDOUT. Once you know the mispelling... you can write wrapper callbacks that use the mispelled method name that simply call the correctly spelled callback (or just alias the bad names to the good names.)
  • Remove last line in Ruby Console?

    3
    0 Szavazatok
    3 Hozzászólások
    342 Megtekintések
    onidarbeO
    ok, thanks
  • What use are Tool id's?

    6
    0 Szavazatok
    6 Hozzászólások
    487 Megtekintések
    Dan RathbunD
    Last I knew Mac only worked with string arguments for actions.
  • 1 second pop-up, timed message

    3
    0 Szavazatok
    3 Hozzászólások
    322 Megtekintések
    onidarbeO
    Short and ride to the point Thanks again Dan! Have a nice new year's eve...
  • Workflow for script coding and testing

    3
    0 Szavazatok
    3 Hozzászólások
    316 Megtekintések
    Dan RathbunD
    (1) If you are going to develop, logon as an admmistrator, so you have full access rights to the plugins folder. (Or right-click the SketchUP icon, and choose "Run As Administrator", or "Run with elevated Privileges" etc.) (2) Forget about zip & rbz during development, that is the avenue of distribution. (3) Stop thinking of SCRIPT, and start thinking of your code as being defined WITHIN and executing FROM your namespaces. You need to choose a toplevel namespace (module name,) and then write ALL of your plugins within a sub-module of your toplevel module. (Clarify: I mean each plugin has it's OWN sub-module of your toplevel author/company module. That way NONE of your plugins clash with each other, NOR any other author's plugins.) (4) BE wary of comparing Ruby to Fortran, BASIC, etc. Ruby is MUCH different. It is a dynamic language. This means that modules and classes can be modified at any time. Methods can be redefined, removed, access changed (made private,) etc. This also means you can reload a file that defines your plugin's module, after making changes, and the changed methods are updated. This is great for development. (5) Ruby is 100% object-oriented. Ruby has 2 (TWO) things. Objects and references that point at objects. Ruby does not really have variables, but the documentation and some query methods refer to "variables", but I think it is best to have programmers from other languages know from day one, that Ruby only has references, not variables like BASIC. For example, Ruby references can point at any object, at any time, of any class, and then be changed (re-assigned,) to point at any other object, of any other class (or perhaps the same class.) So any "typing" of reference names is only in your mind. It it makes you "comfy" to say use bMyRefName to hold a reference only to true or false (or nil,) then thats OK. Add (6) Read the "Pick-Axe" Ruby book cover to cover. (see the Ruby Resources sticky topic.) Doing so will make your journey so much easier, and avoid asking all the questions here that people who do not read the book first have already asked (here and in other forums.) (7) Do not think or write your code in a linear manner. Think in and write code in an event-driven manner. (Have your code respond to things the user does, or act upon objects the user has selected, or do something with the entity the user has just modified, etc.) See the API dictionary on all the observer classes.
  • Get latLong of origin?

    7
    0 Szavazatok
    7 Hozzászólások
    1k Megtekintések
    TomPendergrassT
    Thank you for your help! Turns out the camera that the photos were taken off of had some weird GPS offset, which is why my photos were imported yet placed kilometers away. I solved my problem by using a 'reference point'. I have the user import one photo and place that photo where they believe it was taken. I use that photo's lat and long to modify the rest of the photos that were imported. Success
  • Is the ruby source for rectangle tool or similar available?

    2
    0 Szavazatok
    2 Hozzászólások
    312 Megtekintések
    TIGT
    There are several 'rectangle' plugins available, like '3 point rectangle' ... My own 2Dtools includes a 'rectangle tool' making 4 edges - no face... The principal is very similar to the line-tool example, instead of picking 2 points, you pick 3. The 'box' tool also has a potential crib... Point 1 click = p1 the start of an edge Point 2 click = p2 the end of that edge A Vector - vec = p1.vector_to(p2) Point 3 click - poff - this defines the offset to the opposite side NOT a vertex. A Line - line = [poff, vec] Project p1 & p2 to line p3 = p2.project_to_line(line) p4 = p1.project_to_line(line) Now if you want a face: face = Sketchup.active_model.active_entities.add_face(p1, p2, p3, p4) The edges get automatically added. If you want just edges: edges = Sketchup.active_model.active_entities.add_edges(p1, p2, p3, p4, p1) Remember to close the loop by reusing the first point again at the end... ***To get the temporary graphics rubber-banding that is needed in 'draw'... use the initial 2 points as if it's the line-tool, and then after the stare increments... while waiting for the 'poff' click the mouse's cursor-position can be used for calculating the the dynamically changing projected points from those 2, to draw the four sides of the potential rectangle as the cursor moves...
  • Can't read backslash with Sketchup.read_default !

    7
    0 Szavazatok
    7 Hozzászólások
    731 Megtekintések
    Dan RathbunD
    Well it is replaced with Win32API.rb which is a wrapper that uses the DL library. So you can still use it. In later versions even DL is deprecated and becomes a wrapper into the Fiddle library. They (the Ruby Core people,) want coders to begin using the newer libs. But not every user installs the full Ruby libraries. It is easier to just use the Win32API class, for now.
  • Internal numbering of entities differs in iterations?

    7
    0 Szavazatok
    7 Hozzászólások
    502 Megtekintések
    artmusicstudioA
    hi tig, yes, i understand the principles of giving attributes to entities now and will try to experiment with this. maybe i may go step back to my special situation (just for understanding): i have an axis of different edges, giving a path for 'followme' , then i let create the ruby the same object again and again (imagine: square, path, followme, delete square, path, followme, delete etc.) the funny thing is, that the entities DO have a numbering , which is their position in the array, right? and so a thought, while knowing , which entity has which number in the row, i could access them easily (again: always the same object with same amount of edges and faces from the same procedure) but at this point the numbering of faces in the array changes, although generated thru same procedure. and since the object is a follow-me- object, i cannot give any attributes to single faces, i guess..... so that's the trouble. but i can gerate these objects per hand too (face by face), so i will be able to use the 'attribute' option. regards stan
  • Transformation of single entities ???

    7
    0 Szavazatok
    7 Hozzászólások
    478 Megtekintések
    artmusicstudioA
    hi everybody, thanx for this interesting discussion, and yes, tig's way worls perfectly, so it is possible to immitate the mouse movement of single entities in any angle and direction. fantastic! new_line10 = entities31.add_line pts[1], pts[0] tr = Geom;;Transformation.rotation(pts_senkrecht1,@vector,@angle_m.degrees) group31.entities.transform_entities(tr, new_line10) #MOVE 1 FACE >>>> number distance_m_result = @carrier_w *@totaloffset_x_center/@run vector2 = new_line10.line[1] vector2.length = distance_m_result.abs tr = Geom;;Transformation.translation(vector2) group31.entities.transform_entities(tr,group31.entities[number]) stan
  • How do I represent and keep a track of cuboids I create?

    9
    0 Szavazatok
    9 Hozzászólások
    923 Megtekintések
    Dan RathbunD
    @bobdiya said: But given that the user is likely to rotate the cube (<90 degree off the global axis) ... Because now the default bounding boxes are larger and they don't represent the bounds of the cube themselves. Correct? True. @bobdiya said: ... then I will have to create and keep references to the bounding boxes? BUT then THOSE bounding boxes are not rotated,... their corners do not occupy the same vertices points that the cuboids do. Meaning that cubiods could have been rotate away from each other... so as not to be intersecting after rotation.
  • Coordinates of a vector-cross-point?

    10
    0 Szavazatok
    10 Hozzászólások
    1k Megtekintések
    artmusicstudioA
    oh yes, and how it went......i am just about to begin to understand the basics. but i am proud of having the first version of my ruby nearly finished. the code is still more linear then intelligent, but will be improved step by step. and one day, who knows, i also can deal with metrices in the 5th dimension. merry x-mass stan
  • Code problem between windows-versions ??

    5
    0 Szavazatok
    5 Hozzászólások
    329 Megtekintések
    artmusicstudioA
    hi, problem solved, it was sketchy physics. i will try to redifine my code later, maybe i will find the problem. stan

Advertisement