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

    NoahT

    @NoahT

    10
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    NoahT Unfollow Follow
    registered-users

    Latest posts made by NoahT

    • RE: Application Development Exploding Component Instances

      @tig said:

      Sadly your code example is poorly formatted, making it hard to read...

      Sorry, first time testing out code posting on here. I tried to fix it a bit but it's formatting oddly. Basically, the first part is a ton of filters to select certain component instances, then there is a loop to just explode these.

      @tig said:

      However, here are a few observations that might be related.
      With v2017, when you explode a container all of the references you might have had to entities within that container are lost - all IDs are refreshed.
      The ents=container.explode will return an array of exploded entities [and often more besides] - all with new references - so therefore you will need to re-search that array to get the needed references to any resultant 'containers' etc...

      I'm not sure I follow you here. Are you saying that I will need to re-search the entities after exploding? I am having trouble with the speed of exploding/freezing during exploding, not finding the entities after. Am i stuck with a slow exploding process or are there some tricks to speed it up?

      Thanks, for feedback and further clarification.

      posted in Developers' Forum
      N
      NoahT
    • RE: Application Development Exploding Component Instances

      @slbaumgartner said:

      You might try wrapping the block that does the explodes in a start_operation /commit_operation pair with disable_ui set to true.

      The code is wrapped in a start_operation/abort_operation, sorry for not including but the code is pretty long. Would you recommend a nested start_operation /commit_operation inside my other operation?

      @slbaumgartner said:

      Also, don't have the outliner window open while you run your script. It is known to cause major slowdown.

      I never do but it would be nice if I could close it with my code. I see there is windows specific code but nothing for mac. I also see some suggestions that setting disable_ui to true in the operation command does this as well. Any insight on if disable_ui does this or how to close the window on mac?

      @slbaumgartner said:

      SInce you said it seems to work, I didn't give much thought to the part of your code that picks what to delete, beyond noticing that it seems far more complicated than my gut feels it needs to be.

      Haha, yes it is. I kept getting the "causing visible geometry to merge with hidden" messagebox I have to ok through as well as trying to filter out everything i can to avoid slow explosions so it has gotten kind of ridiculous in my attempt. Any tips on avoiding this messagebox?

      Thank you for the feed back and insight into what's going on ๐Ÿ˜„ I think the ouliner window tip may be very helpful.

      posted in Developers' Forum
      N
      NoahT
    • Application Development Exploding Component Instances

      I'm trying to use code similar to the bomb program that explodes all the visible component instances in the model. It seems to take much longer than exploding manually and I was wondering why or if there were any tricks to speed it up.
      My code basically applies every filter I could find or think of and makes a list of instances to explode from the purged definitions list. Then it eaches through the instances and uses .explode on each.

      This is my code:

      
      page_tab = mod.pages.selected_page
      layers = page_tab.layers
      entz = page_tab.hidden_entities
      
      #Go through definitions to find component instances that need to be exploded
      purg_defin.each_with_index{|defn, d|
      unless defn == mod
      unless defn.image?
      if (defn.count_used_instances > 0)
      unless defn.instances[0].nil?
      if (defn.entities.length > 0)
      defn.instances.each{|inst|
      unless inst == mod
      if inst.layer.visible?
      unless layers.include? inst.layer
      unless entz.include? inst
      if inst.visible?
      unless instances_to_explode.include? inst																																					#puts "checking #{defn.name}"
      instances_to_explode.push(inst)
      #inst.explode
      puts "making arrays #{d} of #{purg_defin.length}"
      end
      end
      end
      end
      end
      }
      end
      end
      end
      end
      end
      end
      }
      
      #explode compiled list
      instances_to_explode.each_with_index{|inst, i|
      puts "exploding instance #{inst} #{i} of #{instances_to_explode.length}"
      inst.explode
      }
      
      
      

      The list compilation doesn't seam to be the problem, just the line where I use inst.explode on each entity in the list. Is this normal? Why? Is there any thing I can try to speed it up? Thank you and sorry for any poor formatting or if I posted in the wrong spot, this is my first post.

      posted in Developers' Forum
      N
      NoahT