sketchucation logo sketchucation
    • Login
    1. Home
    2. talig
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 8
    • Posts 28
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Iterating over the faces of a component - without exploding

      Jim - Thanks.
      I'm using raytest. But I need a fine-grain detail.
      See, if I have a component - raytest will return the component as an answer for the ray hitting any of it's faces. I need to know which face in that component was intersected. More accurately, I need to know that a certain face that should have been intersected, isn't - because it's shaded.

      Thomthom - any thoughts?

      Thanks again guys,

      • Tali
      posted in Developers' Forum
      T
      talig
    • RE: Iterating over the faces of a component - without exploding

      Certainly. The point is to get an array of faces in the end of it all. I don't need the edges, and I don't count them even when I explode the component in advance.

      def get_faces(object)
      	entities = []
      	type = object.typename
      	if type == "Face"
      		return [object]
      	elsif type == "Loop"
      		return [object.face]
      	elsif type == "Group"
      		entities = to_array(object.entities)
      	elsif type == "ComponentInstance"
      		entities = to_array(object.definition.entities)
      	end
      	result = []
      	i = 0
      	while i<entities.length do
      		entity = entities[i]
      		type = entity.typename
      		if type == "Face"
      			result << entity
      		elsif type == "Loop"
      			result << entity.face
      		elsif type == "Group"
      			entities.concat(to_array(entity.entities))
      		elsif type == "ComponentInstance"
      			entities.concat(to_array(entity.definition.entities))
      		end
      		i+=1
      	end
      	return result
      end
      
      def to_array(entities)
      	result = []
      	entities.each { |entity| result << entity }
      	return result
      end
      
      def get_all_selected_faces(selection)
      	result = []
      	for selected in selection do
      		entities = get_faces(selected)
      		result.concat(entities)
      	end
      	return result
      end
      
      posted in Developers' Forum
      T
      talig
    • Iterating over the faces of a component - without exploding

      I've been trying to iterate over the faces of a component without
      exploding it, in the following manner:

      Let c be that component.
      Then d = c.definitions.entities
      for each entity in d - put in in an entities_array.
      iterate over the entities_array: If an entity is a group, take it's
      entities and add them to an entities_array
      if it's a face, add to a result array.

      I'm comparing the results of this to that of "Explode".
      I get the same number of faces, but the calculations I'm using them
      for later disagree.
      I was thinking it might be related to the face's Normal Vector, but
      that seems improbable to me that using the aforementioned method and
      "Explode" will differ in such a manner.

      Essentially, the calculation performed is "raytracing" - I'm checking
      if a point in a face is visible from another point in the model.

      Has anyone seen something like this? Tell me where's the error?
      Thanks

      • Tali
      posted in Developers' Forum
      T
      talig
    • Fumbling Towards Timezone Frenzy

      Hi everyone,
      I'm trying to figure out how to work around Sketchup's Timezone issues.
      It seems like the shadow slider shows the correct time with respects to the location of the model, but:
      ShadowInfo["ShadowTime"],ShadowInfo["SunRise"],ShadowInfo["SunSet"] - are given as time in the local system. Furthermore, it seems that the conversion to or from one another is wrong (since the time difference between Jerusalem, Israel and Los Angeles, California is 10 hours, and not 3 as it is according to SketchUp 7).

      What I basically need is the ability to correctly work in the timezone of the model's location. (including writing the information to files, etc.)
      Please tell me that someone dealt with this before...
      Thanks,

      • Tali
      posted in Developers' Forum
      T
      talig
    • Directory browse dialog?

      Hi everyone,
      My plugin writes text files of computed information, and I want to enable the user to choose where he wants those file to be saved.
      A webDialog won't do here (as far as I can tell) because <input type="file"...> requires to choose a file, and I need a directory, and I don't want to use <input type="text"...> due to obvious usability reasons.
      Ideas?
      Thanks,

      • TaliG
      posted in Developers' Forum
      T
      talig
    • Embedding existing Sketchup dialogs in new ones

      Hi everyone,
      I want to make a dialog that asks the user for a start date & time of a period, and an end date&time.
      I COULD write a nice web dialog for that purpose, but I dislike the notion of "re-inventing" the wheel, and the existing shadow info dialog will always look like a more "native" option for Sketchup.
      Is there a way that I could create my own dialog (web or not) that uses two instances of the original shadow info dialog in a nice single window?
      Thanks,

      • Tali
      posted in Developers' Forum
      T
      talig
    • RE: Face-specific Shadow Info

      I see a lot of you are looking, but no one is answering.
      Can you please at least tell me if you think it can be done/seen examples/ something but don't know how or you simply don't think it's possible from within sketchup?

      Thanks,

      • Tali
      posted in Developers' Forum
      T
      talig
    • Face-specific Shadow Info

      Hi,
      I'm trying to write a plugin, and part of the algorithm needs face-specific shadow information.
      Even knowing which edges are shaded might do... (I need eventually to figure out which percent of the selected face is shaded.)
      Alternatively, if I can programatically figure out which percent of the face is visible to the camera - that would also be good enough...
      I was thinking about using rays but that seems to be rather inefficient and not so elegant, not to mention that I'm not sure that's even possible.

      So I was wondering if there's an elegant way to do that via the Ruby API, and if not - do you know if the SDK can help me there...
      Thanks a lot!
      Tali

      P.S. I'm really sorry if there's already an answer for this in the forum, I looked but I didn't find one...

      posted in Developers' Forum
      T
      talig
    • 1
    • 2
    • 2 / 2