# Is is possible to create construction points in the C API?

**URL:** <https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483>\
**Category:** Developers\
**Created:** [January 25, 2023, 7:03pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483 "2023-01-25T19:03:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffR](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@JeffR](https://forums.sketchup.com/u/JeffR)\
**Post date:** [January 25, 2023, 7:03pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/1 "2023-01-25T19:03:17Z")

</div>

Is is possible to create construction points in the C API?

If not, what is the most efficient way to create them in the Ruby API?

Creating them one at a time with entities.add\_cpoint is very slow.

EntitiesBuilder does not appear to support construction points.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 25, 2023, 8:18pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/2 "2023-01-25T20:18:20Z")

</div>

> [@JeffR](#):
>
> Is is possible to create construction points in the C API?

AFAIK, the “Live” C API is still **read-only**.

However, you could make sure the model is saved, then close it (ie, by starting a new empty model.)  
Open the model file with the C API and add your guide points.  
Then save it with C API, release it and then reopen with the Ruby API.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 25, 2023, 8:26pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/3 "2023-01-25T20:26:26Z")

</div>

> [@JeffR](#):
>
> If not, what is the most efficient way to create them in the Ruby API?  
> Creating them one at a time with entities.add\_cpoint is very slow.

Did you wrap the batch creation in a [undo operation](https://ruby.sketchup.com/Sketchup/Model.html#start_operation-instance_method) with the disable UI switch `true` ?

```ruby
model.start_operation("Add Guidepoints", true)
  ents = model.active_entities
  points.each { |point| ents.add_cpoint(point) }
model.commit_operation

```

In the above example, the `points` array would be calculated outside and before the creation loop.

---

<div class="post-metadata">

**Author:** ![sWilliams](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sWilliams](https://forums.sketchup.com/u/sWilliams)\
**Post date:** [January 25, 2023, 8:29pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/4 "2023-01-25T20:29:37Z")

</div>

I’m seeing a couple of microseconds per cpoint added. What kind of speed are your looking for?

```auto
model = Sketchup.active_model
ents = model.active_entities

count = 1_000_000
t = Time.now

model.start_operation('add cpoints', true)
  count.times { | i | 
    ents.add_cpoint([i,i,i])
  }
model.commit_operation

dt = Time.now - t
puts "#{count} cpoints added"
puts "\u0394t = #{ dt } seconds"
puts "#{ 1_000_000 * dt/count }us per cpoint"
nil

```

---

<div class="post-metadata">

**Author:** ![JeffR](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@JeffR](https://forums.sketchup.com/u/JeffR)\
**Post date:** [January 28, 2023, 1:55am UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/5 "2023-01-28T01:55:10Z")

</div>

I had not set the disable\_ui flag to true. Thanks for that tip.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [October 3, 2023, 11:06pm UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/7 "2023-10-03T23:06:24Z")

</div>

What is this file you have posted and how does it pertain to the topic ?

---

<div class="post-metadata">

**Author:** ![Elinsz](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/elinsz/32/203871_2.png) [@Elinsz](https://forums.sketchup.com/u/Elinsz)\
**Post date:** [October 4, 2023, 1:25am UTC](https://forums.sketchup.com/t/is-is-possible-to-create-construction-points-in-the-c-api/218483/8 "2023-10-04T01:25:31Z")

</div>

Sorry for this mistake, about 9 months ago my PC was hacked, my personal accounts were cloned, so possibly those who were trying to harm me made these posts.  
Until now, I was not aware of this post.  
I have already deleted it, please check if the file is still on the forum.

Thank you in advance for notifying me of what happened, this way I was able to delete it so that it wouldn’t cause any more trouble on the forum.
