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

    Topics

    • B

      [Req] For somebody to please make this plugin

      Watching Ignoring Scheduled Pinned Locked Moved Plugins
      24
      0 Votes
      24 Posts
      745 Views
      B
      Ok the model is exported to fusion 360, it wasn't to hard to do and there weren't to many errors and those were easily fixed (some components were exported twice). If you use the export option, the best result will most likely come from dxf (I used 2014 but I think 2012/2013 will give the same result). The best things was that Components and nested components will still be components and nested within the right components in the fusion 360 file (except for the minor errors mentioned). So far it seems like a decent solution. One big issue though, it seems to crash a lot which is really frustating
    • B

      Help requested for checking all nested instances

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      11
      0 Votes
      11 Posts
      1k Views
      sdmitchS
      @bobvandevoort said: Ah I'll try to be a bit more specific. Let's say I have a model with 3 components, comp1, comp2 and comp3. comp1 has comp2 inside and comp3 is inside of comp2. This then means (if I am correct) that comp1 has a transformation, called trans1, comp2 has one called trans2 and comp3 has one called trans3. If I take comp3 and place it in the model with its own transformation, trans3, it will not be places at its original position in the model. To achieve that it needs to have its transformation multiplied by trans2 and trans1. So now I want to create a matrix "noembed" that only has components that have no other components nested inside them (like comp3 here). However these components should still retain there original location/position in the model meaning their own transformation should be multiplied by all their parent's transformations. In which case this code seem to do the trick cd.instances.each{|ci| > next unless ci.parent==mod > trans_matrix << ci.transformation > noembed << ci > } You are correct that the transformation of comp3 not embedded will be the product of its' and the components instances transformations above it. The code above only would only save comp3's transformtion if it is at the model level. It would be great if you could start at the instance and work up to the top but .parent returns a component definition which doesn't have a transformation associated with it. So you have to start at the top and drill down. This code does that for two levels. Adds a comp3 at model level and erases the instance that it replaces. mod = Sketchup.active_model ent = mod.active_entities sel = mod.selection rmv = [] ci0 = ent.grep(Sketchup;;ComponentInstance);#parent is mod ci0.each{|c0| next if c0.definition.name=="comp3" tr0 = c0.transformation ci1 = c0.definition.entities.grep(Sketchup;;ComponentInstance);#parent is definition ci1.each{|c1| tr1 = c1.transformation if c1.definition.name=="comp3" tr = tr0*tr1 ent.add_instance(c1.definition,tr) rmv << c1; break else ci2 = c1.definition.entities.grep(Sketchup;;ComponentInstance);#parent is definition ci2.each{|c2| tr2 =c2.transformation if c2.definition.name=="comp3" tr = tr0*tr1*tr2 ent.add_instance(c2.definition,tr) rmv << c2; break end } end } } rmv.each{|ci| ci.erase! if ci.valid?}
    • B

      REQ: Checking if components (solids) intersect

      Watching Ignoring Scheduled Pinned Locked Moved Plugins
      22
      0 Votes
      22 Posts
      2k Views
      B
      This is my version of the srcipt for now that seems to work for all non nested component instances module Bob # Huge parts of this code were written by TIG this is a sligthly modified version def self.intersectBob?(e1=nil, e2=nil) mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model instance1 = e1 #sel[0] instance2 = e2 #sel[1] ci_def = instance1.definition tr1 = instance1.transformation test1 = Sketchup.active_model.entities.add_instance ci_def, tr1 ci_def2 = instance2.definition tr2 = instance2.transformation test2 = Sketchup.active_model.entities.add_instance ci_def2, tr2 result = test1.intersect(test2) cnt = result.entities.count if cnt > 0 int=true result.definition.entities.each {|ent| if ent.is_a? Sketchup;;Face ent.material = 'red' #Sketchup;;Color.new(255, 0, 0) end} else int=false end return int end #def self.del() #does not work like this typing Bob.del into the ruby console, meaning result has to be changed from local to global variable but I don't know how yet #result.erase! #end def self.intersectALL() model=Sketchup.active_model ss=model.selection ents=model.active_entities ss.clear gps=ents.grep(Sketchup;;Group) ins=ents.grep(Sketchup;;ComponentInstance) ens=gps+ins ens.uniq! ens.compact! (ens.length).times{|i| (ens.length).times{|j| next if j<=i if self.intersectBob?(ens[i], ens[j]) ss.add(ens[i]) ss.add(ens[j]) end } } puts "Any intersecting component-instances are highlighted..." end end In this script I still need to fix the deleting function which later will have to be added to an observer class so as soon as another is clicked (or a button is pressed) the resulting intersection is deleted. The more important function that still has to be added is that it does the check for all the nested components (and possibly groups). @giro I only have the 32 bits version so can't say
    • B

      Problems exporting 2D images .png .jpg and layout

      Watching Ignoring Scheduled Pinned Locked Moved LayOut Discussions layout
      4
      0 Votes
      4 Posts
      1k Views
      B
      Thanks, But I found out it didn't work for me. Changing the rendering method from raster to vector, did work for some strange reason (this also explains why exporting it as a .pdf does work and exporting it as an image doesn't). Any idea how to solve the problem, especially for when I directly export images from sketchup?
    • 1 / 1