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

    Posts

    Recent Best Controversial
    • RE: Push_tool

      Thanks guys. Yes, I was doing a pickhelper or ray intersection and figuring out the object being clicked on and added it to the global selection. That worked fine, but only allowed selecting one entity at a time. I wanted to switch to select tool so I can use the group selection features that are available in it. Like thomthom suggested, I managed to get that working by backing up the current tool before doing Sketchup.send_action("selectSelectionTool:") and then restoring the older tool on release. This probably won't retain the tool state since I'm actually exiting the tool and re-entering, but it seems to work for my purpose.

      Thanks again!

      posted in Developers' Forum
      A
      ArunYoganandan
    • Push_tool

      Hello,

      I'm trying to temporarily switch to SU native selection tool on a key depress, do my seleections and return back to my tool on key release. From searching around, it looks like
      push_tool and pop_tool might do the trick.
      Dan Rathbun mentions here
      that the parameter is a UI::Tool class object. Is there a way to get this value for the native selection tool?

      Thanks,
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Thumbnail images as textures

      Thanks TIG.

      posted in Developers' Forum
      A
      ArunYoganandan
    • Thumbnail images as textures

      Hello,

      Is there a way to grab thumbnails associated with component definitions and use them as textures without having to save them to disk?

      The only option I see now is to do save_thumbnail and then import the texture which is pretty inefficient.

      Thanks,
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Excluding from undo stack

      Hi Everyone,

      Thanks for your replies and suggestions. Yes, I do agree that I'm twisting the application in a manner that the architecture does not intend to support. I just wanted to see if there were ways to get around the issue I am facing. I will try aborting operations to see if that does what I need.

      Thanks again!
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Excluding from undo stack

      Thanks Fredo. I will try that.

      Pardon my ignorance, but could you please explain what you mean by trapping? I'm able to attach a modelobserver and receive a call during transactionUndo. I assume you mean some way of prematurely exiting so the Undo would not happen, but since this is just an observer and not a subclass, I'm not sure how that could be done. Any explanation would be of great help.

      Thanks again for your help
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • Excluding from undo stack

      Hello All,

      I have been working on adapting Sketchup to Virtual Reality displays. Since regular windows and toolbars are not visible in virtual environments, I create custom floating 3D menus (pie menus) that the user can interact with to select tools, components etc. The menus are just faces and groups with textures applied on them that show up in a particular way (Please see attached image). Since these are regular geometries, their creation also ends up becoming part of the undo stack. As a result, when I continue to undo, the menu components get erased.

      Start_operation allows you to make an operation transparent, but it still is part of the stack. Is there a way to eliminate or exclude a set of operations from the undo stack? That would be of great help.

      Thanks,
      Arun


      radialMenu2.jpg

      posted in Developers' Forum
      A
      ArunYoganandan
    • Losing focus on window

      Hi All,

      As some of you might know, I'm building an immersive version of Sketchup. Since the user would not have access to a real keyboard, I'm simulating keyboard events via 3D menus and using AutoIt to mimic the selection as a keyboard press.
      This is particularly needed for things like setting the number of sides of a polygon or in making n number of copies etc.

      Where I'm facing difficulty is that sometimes SU seems to lose focus on the current window. This happens on the most unexpected SU operations (setting timers or undo or commit operations), after which none of my AutoIt inputs get conveyed as keypresses. Has anyone faced a similar issue of losing focus on current window with SU calls? Also, is there a solution to the same (like directly talking to the status bar without having to mimic a keyboard press)?

      Any help would be very much appreciated.

      Thanks,
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Custom selection tool

      @sdmitch said:

      Using the BoundingBox certainly works as long as the selection box is not rotated which will cause BoundingBox to be much larger than the selection box.

      I see no reason why the selection process should be any slower on a curved surface. It should only matter how many total entities there are in the model.

      Yea. That is the same thing I'm confused about as well. Unless SU has a way of selecting the cylindrical surface as one unit or a collection rather than add each face of the curved surface one after the other(which is what my code does). Also, all my conditionals could be slowing things down as well.

      The selection box is axis aligned, so the they bounding box and the selection box should pretty much be the same size.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @dan rathbun said:

      What platform is this for? PC or Mac ?

      This is for the PC.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @dan rathbun said:

      What platform is this for? PC or Mac ?

      This is for the PC.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @chris fullmer said:

      Are you just making a normal menu? Is that all it comes down to?

      Pretty much. Just that it is 3D and floating in space with the user.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Custom selection tool

      @dan rathbun said:

      One thing is you should be iterating the active_model.active_entities collection, to be sure and only select items in the current editing context. (Which could be the entire model.)

      Thanks for the suggestion. I revised my code to active_entities. Doesn't seem to make much of a difference in performance right now, but I see your point as to how it could in other situations.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Custom selection tool

      @sdmitch said:

      As for question 1,the "dashed" lines defining the edges of the faces that make up the surface should be excludable by testing edge.soft? and edge.smooth? and ignoring it if either is true.

      As for question 2, the only thing in the SU API related to this is the Geom.point_in_polygon_2D which is useless in this case. If you would care to post the code you are currently using, maybe I or someone could offer an openion on what might be done to speed things up.

      edge.soft? and edge.smooth? did get rid of the dashed lines. Thanks so much!

      Here is the function I'm using

      		def selectInVolume( view)
      	
      		#Add the corners from the 3D selection box into a selection volume
      		selectionVolumeBBox = Geom;;BoundingBox.new
      		selectionVolumeBBox.add @corner1
      		selectionVolumeBBox.add @corner2
      		selectionVolumeBBox.add @corner3
      		selectionVolumeBBox.add @corner4
      		selectionVolumeBBox.add @corner5
      		selectionVolumeBBox.add @corner6
      		selectionVolumeBBox.add @corner7
      		selectionVolumeBBox.add @corner8
      		
      		
      		sel = Sketchup.active_model.selection
      		
      		universalList = Sketchup.active_model.entities
      		
      		universalList = universalList.to_a - $unSelectableList
      		
      		universalList.each{ |b|
      
      			if(b.class != NilClass )
      
      				if(b.visible? == true)
      				
      					allCornersLieWithin = true
      					boundBoxObject2D = b.bounds
      					
      					resultantboundBox =  boundBoxObject2D.intersect selectionVolumeBBox
      					status = resultantboundBox.empty?
      					
      					if(status)
      					
      					else
      						if(selectionVolumeBBox.contains?(b.bounds.center))
      						
      							for i in 0..(7)
      								pt = (b.bounds.corner(i))
      
      								if(!selectionVolumeBBox.contains?(pt))
      									allCornersLieWithin = false
      									break
      								end	
      							end
      	
      							if(allCornersLieWithin == true)
      									sel.add b
      							end
      						
      						else
      							#if center doesnt lie within, then no point in checking for corners. the object clearly is not completely within
      						end
      					end
      
      				
      				end
      
      			end				
      		}
      	
      	end
      
      posted in Developers' Forum
      A
      ArunYoganandan
    • Custom selection tool

      Hi All,

      As some of you might be familiar, I'm building an immersive version of Sketchup. One of the custom tools I'm building is a 3D selection tool. i.e, you select objects that lie within a cuboid in 3D rather than a rectangle drawn in screen space.

      The selection algorithm basically walks through all the entities in the active_model.entities and checks to see if the bounds of the entity are intersecting/contained with that of the selection cube or not.

      One of the difficulties I'm facing is with curved surfaces like a cylinder. My algorithm seems to be selecting every edge on curved surfaces, rather than the just the surface.

      https://lh3.googleusercontent.com/-uce63AbM914/UIBN8hiEX-I/AAAAAAAAkUU/NcLMsdKbmzY/s1440/Screen%2520Captures1.jpg

      Here is a screenshot. To the left is the effect of using Sketchup's native selection tool and to the right is the one I wrote. SU's native tool selects 72 entities, while mine selects 96. On comparing the entities, the extra ones I have are edges on the curved surface.

      I have two questions.

      a) Is there a way to differentiate these edges on curved surfaces from others, so I don't include them in selection.

      b) My performance is really slow with curved surfaces. Does SU have a region selection mechanism? or is there a better algorithm I can use than what I described above. I can post code snippets if needed.

      Thanks in advance for your help
      Arun

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @dan rathbun said:

      I never really understood the desire to have or use immersive 3D editing.

      Anyway... although we cannot via Ruby enter into an edit context (it is reserved for user decision only,) we CAN cause SketchUp to exit edit contexts.

      Sketchup.active_model.close_active()

      But you must test if all nested edit contexts have been exited thus:

      while Sketchup.active_model.active_entities != Sketchup.active_model.entities
      >   Sketchup.active_model.close_active()
      > end
      > 
      

      💭

      We are trying to see if we can get architects to model immersively. I might be able to share a video with you in a few weeks.

      I might be asking too much, but I do not want to exit the exit edit context. I want to be able to stay in the edit context, but turn the visibility of textures on. I understand if Sketchup does not provide this kind of flexibility though.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @chris fullmer said:

      A user "selects" an icon by double clicking on it? And that then opens the component into edit mode, is that the problem?

      If so, when you make the 3d toolbar component (or group), just make it be locked. Then when the user double clicks on it, they will not enter into edit mode. That is one possible fix.

      You might also try making your own "tool". This way you have control of the cursor and what it can do. so when a user clicks on something, it won't go into edit mode.

      Does any of that make sense? Do you have a screenshot of what you immersive experience and toolbar look like? That might also help to make more sense of the possible solutions.

      Chris

      The user actually selects an icon using wiimote like controllers. The mouse is not involved in selecting the floating icon, and the selection works as intended without the aforementioned texture issues. The mouse emulation is involved in selecting other 3D objects
      and this selection is what causes the textures on the icons to go away. I have attached a screenshot to show the problem.

      https://lh4.googleusercontent.com/-7TxxW9czZgU/UIBJ6j3F8RI/AAAAAAAAkUA/M9qANkFCTXg/s1440/34.jpg

      to the right is the floating tool icons. When the box is double clicked, the texture on the painting tool icon goes away.

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @chris fullmer said:

      Nope.

      Are you making a 3d model where people can click on objects - like virtual art gallery where the user can click on the painting to bring up a webpage or video about the painting for example? Or are you just trying to add a menu for a plugin you've written and making a 3d model of it is the simplest way you came up with?

      Chris

      It is more closer to the first one. Because this is an immersive environment, users do not have access to the toolbars or any windows related stuff. Therefore, I'm having to represent these toolbars in the form of 3D radial menus that the users can interact with. These 3D menus are made up of icons which have textures that represent the corresponding tool. When a face is selected, all these textures go away leaving the user clueless as to which icon is which tool (cos they all appear blank)

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @thomthom said:

      It's a feature of SketchUp - to make you focus on the stuff in the open context.

      Is there a way to turn that feature off?

      posted in Developers' Forum
      A
      ArunYoganandan
    • RE: Texture overlay on selection

      @dan rathbun said:

      EDIT: Sorry this looks to be standard behavior.

      @dan rathbun said:

      Model Info > Components
      Adjust the fade sliders to suit yourself.

      In Ruby see these attributes:
      [pre:zw2i7fu9]InactiveFade ..............: 0.25
      InactiveHidden ............: false
      InstanceFade ..............: 0.5
      InstanceHidden ............: false[/pre:zw2i7fu9] model.rendering_options()

      EDIT: Seems the textures are still turned off in edit mode.

      @Dan: You are right. InactiveFade seems to make reduce the overlay transparency, but does not bring back the texture. I tried playing with the other parameters and had no luck bringing back the texture.

      posted in Developers' Forum
      A
      ArunYoganandan
    • 1
    • 2
    • 1 / 2