sketchucation logo sketchucation
    • Login
    1. Home
    2. maricanis
    3. Posts
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 14
    • Posts 43
    • Groups 1

    Posts

    Recent Best Controversial
    • Position_material problem

      Hi,

      I'm using some images as textures for faces in the model. To position textures correctly for each face, I calculate position of texture and add texture with 'position_material' method.
      While testing plugin on various examples, I've encountered next problem, which I don't have idea how to solve.

      Assume that 'face' is Face object on which we apply new texture, and that it is inside some group.
      Example code:

      
      materials = Sketchup.active_model.materials
      material = materials['material_name']
      face.position_material(material,[[237.274, 715.334, 199.096], [0, 0, 0], [467.052, 715.334, 391.903], [1, 0, 0]],true)
      

      If I'm outside of the group where 'face' entity is previous code gives texture 'material_name' positioned correctly on the face.
      If I'm inside of the group where 'face' entity is, previous code positions 'material_name' completely wrong.
      In both cases I use exactly the same points coordinates for material positioning.

      Note that vice versa problem happens also: if I set coordinates so positioning is correct while group is opened, when I close the group and try to position material it is wrong.

      Why this is important for my plugin: once materials are imported their coordinates are saved as attributes for each face. I have option in plugin to toggle on/off these materials (and show face default material instead).
      When I should toggle on materials - I use get_attribute to get coordinates and then position materials on faces.

      In case that different groups are opened in the moment of import and later during toggling - I get wrong positioning of textures.

      It seems like this coordinates are treated as local for the group or something like that, and my assumption was that these are coordinates in SketchUp coordinate system.

      Any ideas why this happens and how to solve the problem.

      Thanks in advance,
      Marija

      posted in Developers' Forum
      M
      maricanis
    • RE: Extend view.write_image?

      Thanks TIG,

      As you mentioned these aren't real objects. They need to be on the screen on constant position even when user changes a view, and user chen toggle thme on/off from gui.

      Idea is I import some data into model in form of false color textures for faces, and these additional things are false color legend and some comments.

      So for export I definitely need them - since image with false colors without legend doesn't have much sense.

      If no other solution found (beside using external screenshot programs), I'll have to use your group idea, and modify my approach to false-color legend preview.

      Thanks again,
      Marija

      posted in Developers' Forum
      M
      maricanis
    • Extend view.write_image?

      Hi,

      In my plugin script I put various text and draw objects on the screen with
      view.draw_text and view.draw2d

      When I export current view to 2D image with either File->Export->2D Graphic, or in script with view.write_image, text and rectangles from the screen aren't included in output images (only model entities are visible).

      Is there some way to export to an image all objects visible on current screen?

      Thanks in advance,
      Marija

      posted in Developers' Forum
      M
      maricanis
    • 1
    • 2
    • 3
    • 3 / 3