sketchucation logo sketchucation
    • Login
    1. Home
    2. kiesewetter
    3. Posts
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 15
    • Posts 44
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Back_material of a face

      working meanwhile... ๐Ÿ˜ณ

      thanks for the help.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Back_material of a face

      But that part of the code:

      
      if @woche.to_i >= start.to_i && @woche.to_i < ende.to_i #@woche variable of the class
          e.material = mats["im_bau"]
          e.back_material = mats["im_bau"] #why doesn't it work?
      end
      if @woche.to_i >= ende.to_i
          e.material =mats["fertig"]
          e.back_material =mats["fertig"]  #why doesn't it work?
      end
      if @woche.to_i < start.to_i
          e.material = mats["noch_nicht_angefangen"]
          e.back_material = mats["noch_nicht_angefangen"]  #why doesn't it work?
      end
      

      should have been working, shouldn't it?
      I don't understand why the materials were assigned to the front, but not to the back of the face.
      any idea?

      posted in Developers' Forum
      K
      kiesewetter
    • Back_material of a face

      Hallo!

      I am going to set the material of a face in the following method. To avoid problems with the oriatation of the face's normal I want to set its back_material, too.
      I tried it with the following code:

      
      def status_anzeigen #funktioniert, nur das mit dem alpha wert im material inplanung noch nicht so
        mod = Sketchup.active_model
        ents = mod.entities 
        sel = mod.selection 
        mats = mod.materials
        bau_mat = mats.add "im_bau" if not bau_mat = mats["im_bau"]
        bau_mat.color = [255,127,38] 
        fertig_mat = mats.add "fertig" if not fertig_mat =mats["fertig"]
        fertig_mat.color = [211,211,211] 
        inplanung = mats.add"noch_nicht_angefangen" if not inplanung = mats["noch_nicht_angefangen"]
        inplanung.color = [176,196,222] 
        inplanung.alpha = 0.3 
      
        ents.each{|e|
                  if e.typename == "Face"
                       start = e.get_attribute "ablauf", "baubeginn"  #attributes that were assigned to the faces before
                       ende = e.get_attribute "ablauf", "bauende"     #attributes that were assigned to the faces before
                       
                      if (e.material) #checking wehther the faces current material belongs to the ones created at the top of the method, if not, save the name of the current material as an attribut
                   
                         invalid_materials = ["im_bau", "fertig", "noch_nicht_angefangen"]
                         unless invalid_materials.include?( e.material.name )
                           mat_vorher = e.material.name
                           e.set_attribute("ablauf", "material", mat_vorher)
                         end
                       end
                       
                       
                       if @woche.to_i >= start.to_i && @woche.to_i < ende.to_i #@woche variable of the class
                         e.material = mats["im_bau"]
      				   e.back_material = mats["im_bau"] #why doesn't it work?
                       end
                       if @woche.to_i >= ende.to_i 
                         e.material =mats["fertig"]
      				   e.back_material =mats["fertig"]  #why doesn't it work?
                       end
                       if @woche.to_i < start.to_i 
                         e.material = mats["noch_nicht_angefangen"]
      				   e.back_material = mats["noch_nicht_angefangen"]  #why doesn't it work?
                       end
                  end
                       
                 }
      end
      

      Only the "front" of the face was changed to the new material. Does anybody know what mistake I made?
      Thanks for your time.
      Tim

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Hiding an Entity

      Great!
      Thank you.

      posted in Developers' Forum
      K
      kiesewetter
    • Hiding an Entity

      Hallo!

      How is it possible to hide and unhide an entity?

      Thanks for your time.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Deleting entities on a layer doesn't work

      I study civil engineering and the script is some kind of homework. I'll talk to my tutor in two days. After that I'll know wether I'm allowed to give you the code.
      Thanks so far.
      Tim

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Deleting entities on a layer doesn't work

      Step by step what I want to do:

      1. a scribt assigns information to selected faces of the model as attributes.
      2. another one creates a bar chart (the entities that should be erased later) based on the attributes of the faces on a layer called "balkenlayer".
      3. a selection observer is used to go back to the model to go on working on it. that observer should delete the bar chart (everything on the layer "balkenlayer").
      4. later it schould be possible to invoke the script that created the bar chart once more.

      it is working so far. in the 3. step every entity on that layer seems to be erased. but if i invoke the scribt once more as mentioned in step 4, sketchup tells me:

      "your recent operation has caused visible geometry to merge with existing geometry on a hidden layer"

      although the is nothing to see.
      do know now what i am trying to receive?
      is there maybe an array that stores the entity although it got erased or something like that?

      thank you guys for your time.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Deleting entities on a layer doesn't work

      The geometry isn't disconected. I wrote a scribt that should display some information, that is saved as an attribute of the faces, in a diagramm an text on a different layer ("balkenlayer"). Then it should be possible to go on working on the model and to invoke the scribt that shows the information on "balkenlayer" again. So far the diagramm and the text is displayed on the layer and the geometry of it seems to be erased. But when I invoke the scribt one more time, Sketchup still tells me, that:

      "your recent operation has caused visible geometry to merge with existing geometry on a hidden layer"

      Although I meanwhile use the following code:

      layer = layer_array["Balkenlayer"]
      	  return nil if not layer
      	  mod.entities.to_a.each{|e| next if not e.valid?; e.erase! if e.layer==layer}
      

      I don't understand why.Though there is no geometry to see if only the "Balkenlayer" is visible.
      Any idea?

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Deleting entities on a layer doesn't work

      But isn't that exactly the code I already used?

      posted in Developers' Forum
      K
      kiesewetter
    • Deleting entities on a layer doesn't work

      Hallo!

      I wrote a scribt that creates some entity objects on a layer called "Balkenlayer". Now I try to write a scribt that deletes every entity object on "Balkenlayer" to be able to execute the first scribt I wrote more then only one time without having the entity objects created by the first invoking of the scribt on the layer.

      As adviced I used

      mod = Sketchup.active_model
      mod.active_entities.to_a.each{|e| next if not e.valid?; e.erase! if e.layer==layer_array["Balkenlayer"] }
      

      to delete the objects on Balkenlayer. But every time I invoke the first scribt that created the objects on "Balkenlayer" after the should have been deleted, Sketchup opens a window that tells me:
      "your recent operation has caused visible geometry to merge with existing geometry on a hidden layer"

      In the next step nothing happens.
      Do you know what I have to change?
      Thanks for your time.
      Tim

      posted in Developers' Forum
      K
      kiesewetter
    • Deleting a layer

      Hallo!

      I tried to delete a layer named "Balkenlayer" with the following code:

      
      mod = Sketchup.active_model
      layer_array = mod.layers
      layer_array.each{|l|
      	                if l.name == "Balkenlayer"
      	                   l.erase!
      		                puts "Balkenlayer deleted"
                         end
      	              }
      
      

      Why isn't it working?
      Thanks for your time.
      Tim

      posted in Developers' Forum
      K
      kiesewetter
    • Deleting an observer

      Hallo!

      Is it possible to deactivate or delete an observer after the observer has been invoken? Ideally in the observer itself.

      Thanks for your time.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Selectionobserver

      hmmm... ok. in this case i don't understand why the lines behaved like that. not that important.
      ok, thanks to you once again. ๐Ÿ˜„

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Selectionobserver

      the edges were on the same layer (tested it with test=e.layer; puts test)

      could it be that lines only can be deleted, if they don't border a face?

      i executed the script to delete the entities twice, in the first step only the faces were deleted. in the second step the lines were erased.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Selectionobserver

      works with the faces, but all the lines aren't erased. any idea why?

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Selectionobserver

      first of all, thank you guys.
      ok, the ...BulkChange observer responds.
      is it possible to delete instead of the entities in the selection every entity on a certain layer?

      posted in Developers' Forum
      K
      kiesewetter
    • Selectionobserver

      Hallo!

      I tried to write a script that displays in the ruby window the name of the layer the entity is arranged at everytime it gets selected. After that the entity should be erased. I used the folling code an it didn't work...

      class Selbserver < Sketchup;;SelectionObserver
      
      
      def onSelectionAdded(sel)
      	
      	sel.each{|e|
      	           layer=e.layer.name
      			   puts layer
      			   e.erase!
      			 }
      			 
      end
      
      
      sel=Sketchup.active_model.selection
      sel.add_observer Selbserver.new
      
      #to load it
      #load "C;/Users/tim/Desktop/observertest.rb"
      
      
      
      end
      

      i have no idea, why nothing happens when i load the script an select an entity after that.

      thanks for your time.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Text in the corner of a rendered image

      i know meanwhile how to...
      thanks a lot.

      posted in Developers' Forum
      K
      kiesewetter
    • RE: Text in the corner of a rendered image

      soungs good. and how to delete the note?

      posted in Developers' Forum
      K
      kiesewetter
    • Text in the corner of a rendered image

      hi everybody!

      is it possible to create a text in the corner of an image that is rendered with view.write_image at which the resolution of the rendered image differs from the width and height of the current view.
      for example:

      current view = 1600*1200

      an image rendered with view.write_image 800, 800

      (to save information of the current model on the image)

      thanks for your time.
      tim

      posted in Developers' Forum
      K
      kiesewetter
    • 1
    • 2
    • 3
    • 1 / 3