Author Topic: Removing a named Polygon  (Read 1977 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Removing a named Polygon
« on: November 25, 2015, 04:22:33 PM »
I have a named polygon created using scicompanion. As well as the other polygons which fall under the default name.

I am adding the polygons at init
Code: [Select]
  (method (init)

If the skimmer is gone, which corresponds to the skimmer poly, I have been unsuccessful at removing the polygon.

I tried the code from both eqoquest and kq6, which is pretty much identical. I am assuming that global2 maps to gRoom, which might be part of my problem if I am mistaken there.

Code: [Select]
(send ((send gRoom:obstacles)):delete(@P_SkimmerPoly))

I tried it with and without the @ symbol. Both ways compile fine, however the poly is ever present. Anyone have any ideas on how to accomplish the removal of the polygon generated by companion and housed in the shp file. I should be able to take it out of the shp file and actually code it to an instance of poly and try again, which I will probably do for testing, but that loses the ease of use that Troflip built into scicompanion for working with the polygons. So I would rather not make that plan a

Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Removing a named Polygon
« Reply #1 on: November 25, 2015, 04:36:57 PM »
obstacles deals with polygon objects, not buffers of polygon points. So you need to do something like:

Code: [Select]

Code: [Select]
(method (init)
    // Stash it off so we can remove it later:
    (= shipPolygon CreateNewPolygon(@P_SkimmerPoly))
    // Add it:
    (send gRoom:addObstacle(shipPolygon))

Then when you want to remove it:

Code: [Select]
(send (send gRoom:obstacles):delete(shipPolygon))
« Last Edit: November 25, 2015, 04:38:31 PM by troflip »
Check out my website:
Groundhog Day Competition

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.115 seconds with 23 queries.