Well since anyone answered yet it seems that this is not of any interest to someone else.
Anyhow I will post my findings.
I have my code tweaked for now that it inserts a block when I double click on my drawing and right there where I clicked. So far what I want. Ok, I am hooking the mouse button up event and I use the function GetSelectionPointInSketchSpace2 to get a point and because of some SWX dynamics the point is not really selected when I click only once, but it works when I double click if the time between the clicks is not too long.
Now I went a step further and somehow I think the developers of SWX maybe have a bad feeling of what you might want to do with their API.
It's really strange for me that I have to define a block definition at first from the block file with a point where to place it. Is a definition not only a definition? Why do I have to give a point where to put it?
Ok, if you give that function MakeSketchBlockFromFile a point where to put the definition you get the block on your paper but the returned object is nothing. Next step of enlightment is that you can pass "nothing" for the point and, hey, you get an object in return, but the block is still inserted at the origin of the clicked view.
Ok we have now the object to pass to InsertSketchBlockInstance we just have to be sure we delete that first unwanted block definition which really looks like all the other block we insert with the definition.
With that function we create a SektchBlockInstance and.... WOW we get something back and not nothing we can work with and use the SetAttributeValue of that instace to manipulate the counter and count it up and up on every double click.
But what is when the user exits that function, has added some of those blocks and then starts it again and wants to add more?
If we create again the block definition we get nothing in return. I assume you can't create a new definition if a block made of that file is already on that paper. I think I have to search one and make a copy of that object.
So far so good.
Still remains that first block which is only the definition but a real block, well I am not that far that I know how to delete it.
Now to the next step. All that blocks should be on a special layer named "PTZ". We implent that on starting the function set the cureent layer to "PTZ" with a layer manager, check if the layer is now "PTZ" and if not create a new layer with the wanted options.
Cool, it works! All my blocks I set with double clicking are on the new layer!
Hurray!!! Nearly finished!!!
Now we just have to set the layer back to "- Per Standard -" when we exit the function... BANG!!! this is not possible (Set -Per Standard- as active layer)...
Work around: I will display a message to my users after the exit the function and ask them to set back the layer...
I for one would be interested in something similiar to what you described but I don't have any API skills to make it myself or be of assistance. (nor time atm to learn it)
A question for you : wouldn't it be more convinient for the user if the number that gets increased is able to be increased independant of time of placement.
To further clarify :
- imagine putting in 50 of the needed blocks
- later having to alter the amount of blocks or the sequence they are in
If the numbering is linked to when you put it in and things change one ends up to having either repostioning a whole bunch of them or to delete and start over. If however one is able to put them in with either clicking or perhaps even with the add of 'patterns' and then afterwards be able to run a routine to alter the shown number by clicking or double clicking them the numbers could easily be put in any desired sequence or one could use the same routine to later alter them.
I have to confess that the origin of my question is for a selfish reason, namely if it was able to do exactly that then I would gladly be a beta tester for it
well what I did so far is the base function. Our main workflow will be to make that drawing ready and when that's done then we start that numbering function and place numbers near some measures and the numbers should increase.
I know there might be the wish to change that afterwards and I am thinking of doing that with a property manager page.
For example I have a field where the next number is in and when you click the next mark gets that number so you can start at a certain number again or whatever.
Also I want to easily change the numbers already on the sheet. Like you said, renumbering or shifting numbers. I am thinking about that.
I am willing to share my findings but that function is embedded to our so called "SMTools" which do a lot more things we need for our workflows. So I can only share that function, not the whole add-in.