Author Topic: Event: polyline generated  (Read 268 times)

0 Members and 1 Guest are viewing this topic.

mastrolube

  • Mosquito
  • Posts: 3
Event: polyline generated
« on: February 05, 2021, 09:18:47 AM »
Hello everyone! I'm not new, but my username got lost :S

Anyway, I've moved to C# and .Net and I'm trying to port all my lists to that.
I wanted to do a little extra to improve my productivity. I have a tool (which is not mine and I don't have the source code either) that draws bars. To accomplish that it generates a polyline, which represents the area of these bars, and some lines that represent the bars themselves.
All I want is to generate a hatch in the area of that polyline. The problem is that I'm not able to get the Event when that polyline gets created. The last object it's always the bar which I'm not interested in.

My question is: is it possible to create an Event to find out when that polyline with a specific layer gets generated?
Maybe I can look inside the database and search for the last polyline entity?
Any advice?
Thanks!

huiz

  • Swamp Rat
  • Posts: 885
  • Certified Prof C3D
Re: Event: polyline generated
« Reply #1 on: February 05, 2021, 09:36:04 AM »
There is a handler for newly created objects but it might not catch the polyline. If the bar is placed as one object in a transaction you probably will not see the event happen.

The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

n.yuan

  • Bull Frog
  • Posts: 304
Re: Event: polyline generated
« Reply #2 on: February 05, 2021, 09:53:59 AM »
So you want to have a single hatch covering the area of the polyline (thus trying to generate it before the bars are drawn). Are the polyline and the bars on the same layer? If not, then things would be easy to do: after the whole thing is drawn (the polyline and the bars. that is, after running the said tool's command), you can start to run your own code (maybe, by handling CommandEnded event to run your code automatically), which would freeze the bar layer (so that the polyline would be a shown as empty area ready to be hatched), add hatch to the polyline, and then thaw the bar layer back.

mastrolube

  • Mosquito
  • Posts: 3
Re: Event: polyline generated
« Reply #3 on: February 05, 2021, 11:19:42 AM »
Thank you guys for the quick reply :)

As you can see it's quite hard to understand where the bars are overlapping, so I generate these hatches that help me a lot in design mode..

As far as I understand the tool works this way: if I modify the polyline, it will be deleted and recreated with the resulting changes. (more/fewer bars, different orientation, and so on)

By now I was just generating hatches by selecting them but with every change of the polyline, I've to run again my old lisp.
The idea is to generate that hatch every time this polyline with that layer gets created. (and deleted of course)

The polyline (which is open, but it's not a problem) is in an independent layer.