Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:58:02+00:00 2026-06-04T09:58:02+00:00

https://developers.google.com/sketchup/docs/ourdoc/entities I want to add an array of entities to an entities collection, but

  • 0

https://developers.google.com/sketchup/docs/ourdoc/entities

I want to add an array of entities to an entities collection, but the entities collection (as you can see in the reference) requires i add them by type, ie. entities.add_edge(). What’s the best way to do this for an array of mixed types?

Here’s a snippet – the second last line isnt valid (a generic .add doesnt exist)

layers.each do |layer|
    layerEnts = []
    entities.each { |e| layerEnts << e if layer == (e.layer) }
    layerGroup = entities.add_group
    layerGroup.name = layer.name
    layerGroup.entities.add(layerEnts)
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:58:04+00:00Added an answer on June 4, 2026 at 9:58 am

    You can call methods in a dynamic way using send

    Assuming that you can get the type doing layer.type this should solve your problem.

    layerEnts.each do |l|
      type = l.typename.downcase
      layerGroup.entities.send("add_#{type}".to_sym, l)
    end
    

    UPDATE: Just reading the documentation seems that there is actually a method to get the type, it’s typename and seems it’s camel cased so we need to downcase it.

    https://developers.google.com/sketchup/docs/ourdoc/entity#typename


    Also it seems there are types with more than one word so you need some underscores in there. Here is a solution

    layerEnts.each do |l|
      type = l.typename.gsub(/(.)([A-Z])/,'\1_\2').downcase
      layerGroup.entities.send("add_#{type}".to_sym, l)
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to add https://developers.google.com/recaptcha/docs/aspnet to an ASP.NET/VB project at the login screen. However,
I've tried to run this code locally, but the map doesn't show up. https://developers.google.com/fusiontables/docs/samples/change_query
I am working through this tutorial https://developers.google.com/cloud-print/docs/android for google cloud print. I am trying
I want to integrate Facebook with my Birthday App, so I started https://developers.facebook.com/docs/mobile/android/build/ working
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
i am referring to an Fusion Tables API Example „Update Query https://developers.google.com/fusiontables/docs/samples/change_query It's is
I followed steps here: https://developers.facebook.com/docs/guides/mobile/#android but I really don't get how use Graph API
In https://developers.google.com/+/api/latest/activities#object.attachments , there would have attachments in activities search response, but how to
I have been working with the google docs api found here: https://developers.google.com/google-apps/documents-list/#introduction This issue
In this page: https://developers.google.com/appengine/docs/python/datastore/keyclass#Key_from_path This part: Key.from_path(kind, id_or_name, parent=none, namespace=None, **kwds) Builds a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.