I am very new to code autocad with .net
I would like to implement event listener on all the block references in autocad.
Is it possible to do it by .net code?
use case: I would like to show some custom parameters of a block reference when user clicks on the block reference.
It should not be like auto-cad prompting user to select an object..and then data would be displayed.
It should be like a event listener.On click of block reference its properties in custom implemented palette should change..
Request to share some insights to achieve this functionality...Basically event listener should get attached to all block reference on a single command and a default palette should get loaded..After loading whenever user clicks on any block reference..custom parameters inside custom palette should change..It can be similar to properties palette..when we open properties palette it will show properties of current selected object..when we click on different object..properties pannel will automatically get changed..
Regards
Teja
@Anonymous wrote:I am very new to code autocad with .net
I would like to implement event listener on all the block references in autocad.
Is it possible to do it by .net code?
use case: I would like to show some custom parameters of a block reference when user clicks on the block reference.
It should not be like auto-cad prompting user to select an object..and then data would be displayed.
It should be like a event listener.On click of block reference its properties in custom implemented palette should change..
Request to share some insights to achieve this functionality...Basically event listener should get attached to all block reference on a single command and a default palette should get loaded..After loading whenever user clicks on any block reference..custom parameters inside custom palette should change..It can be similar to properties palette..when we open properties palette it will show properties of current selected object..when we click on different object..properties pannel will automatically get changed..
Regards
Teja
What you want to do is complicated, but possible, given several years of full-time experience with AutoCAD .NET programming.
So, are you asking for someone here to write it for you?
Actually am not asking for the whole code..few pointers or help to achieve such functioanlity..
Like features of selecteventhandler..
I have gone through the following post
https://forums.autodesk.com/t5/net/cursor-pick-object-event/td-p/3323659
It was partial
This article is on the same, or very similar topic. It should give you some ideas on how to go with your exact requirement:
http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html
Norman Yuan
@Keith.Brown wrote:
You don’t need to place an event handler on every block. You just need to monitor which blocks are selected. Try researching the impliedselectionchanged event of the document. Even for a new programmer it should not take much time to get a working prototype up and running. Certainly not two years.
Who said it would take two years to write?
What I said, was that doing it (as outlined by the OP's 'specificiation') will require someone that has a couple of years of experience with the API.
@Anonymous wrote:Actually am not asking for the whole code..few pointers or help to achieve such functioanlity..
Like features of selecteventhandler..
I have gone through the following post
https://forums.autodesk.com/t5/net/cursor-pick-object-event/td-p/3323659
It was partial
Handling the events needed to update your UI when the selection changes is only 10% of what is required in most real-world use cases.
For example, what are the 'parameters' that you want to display? Where do they come from?
What if more than one object is currently-selected? Do you want to display an aggregate view of parameters for multiple objects, like the Properties Palette does?
All of those variables will determine how much work is involved, but doing that work still requires some experience with the API.
@Keith.Brown wrote:
So if the poster wanted to do it themselves you are implying that it would take at least two years of programming the api before they could complete as they have no experience with the API. That might have been true 10years ago but certainly not today. There are more than enough articles on the web for someone to complete in a week with no programming experience. All they want to do is be able to select a block and show its attributes in a palette.
There's no need for programming to do that. AutoCAD already does that (display attributes of selected blocks in the properties palette).
I think that also confirms that you hold an overly-simplistic view of the the OP's actual needs.
Why on earth would he be asking to be shown how to reinvent the properties palette?
@Keith.Brown wrote:
Companies pay a lot of money for that type of customization. They want the simplest things and want to pay money for it. I have made the exact thing for a couple of clients myself. Never under estimate what a company will pay for.
I've also seen consultants fired for knowingly-reinventing what already comes in the box.
You seem to be deliberately misinterpreting the OP's original request, only to support your argument.
Here it is again, with emphasis:
@Anonymous wrote:I am very new to code autocad with .net
I would like to implement event listener on all the block references in autocad.
Is it possible to do it by .net code?
use case: I would like to show some custom parameters of a block reference when user clicks on the block reference.
It should not be like auto-cad prompting user to select an object..and then data would be displayed.
It should be like a event listener.On click of block reference its properties in custom implemented palette should change..
Request to share some insights to achieve this functionality...Basically event listener should get attached to all block reference on a single command and a default palette should get loaded..After loading whenever user clicks on any block reference..custom parameters inside custom palette should change..It can be similar to properties palette..when we open properties palette it will show properties of current selected object..when we click on different object..properties pannel will automatically get changed..
I don't see the word 'attributes' mentioned anywhere, and 'custom parameters' could be anything, such as dynamic block properties, private application data (XData/Xrecords), etc. So, from here it looks like you're just making assumptions to support your argument. I don't make assumptions solely for the purpose of supporting my opinion. Furthermore, the above also makes it clear that what the OP is asking for is a functional-equivalent of the Properties Palette.
The work required to provide the solution to the OP's request requires 1-2 years of development experience with the .NET API and other aspects of the .NET framework, such as System.ComponentModel (e.g., displaying information in a PropertyGrid). Were that not the case, he wouldn't be replying to 6-year-old posts, asking someone to give them their code.
Feel free to disagree all you wish, but that's my opinion and it's not going to change. And if you think it's such a trivial problem, write the code for him, because like most things, it's easier said than done.
I won't encourage someone that doesn't have the required experience to attempt to do a project that I doubt they would be able to successfully complete. If you were the client, and someone was trying to dupe you into paying for something produced by someone that lacks the required experience, you'd probably want to first make sure they're carrying professional liability insurance. Do you know what that is?
Thanks for the reply...
I was asking for inputs as i did not find much references anywhere how to proceed.
And for your information there are lot of changes in .net api itself from 2012 to now..
And was trying with javascript api as well and nthng is compatible with 2018 autocad..
So instead of years of experience debate insights would have been much more helpful..
Regards
@Anonymous wrote:
Thanks for the reply...
I was asking for inputs as i did not find much references anywhere how to proceed.
And for your information there are lot of changes in .net api itself from 2012 to now..
And was trying with javascript api as well and nthng is compatible with 2018 autocad..
So instead of years of experience debate insights would have been much more helpful..
Regards
Being familiar with the API is what will tell you how to proceed.
Since you seem to think you can run before you learn to walk, and that you can walk before you learn to crawl, like most of us here had to do, I'm sorry to say that I have little sympathy for you.
If insights were what you wanted, you would have answered the questions that I >asked you above<, but you didn't do that.
The other thing I find odd is that you said you were new to the .NET API. If that is true, how can you know how much the API has changed from AutoCAD 2012 to present?
And for your information, the .NET API has changed relatively-little over that period.
@ActivistInvestor..Thanks for your suggestions..
Doing small research of different implementations of things,it self shows there are many changes that are done in auto-cad API.
I feel discussions over knowledge is better than just debating over things like years of experience
And no one is programmer by birth..every should start things at some point..
And we are not implementing the auto cad .net api alone..its a mix of javascript + .net api
And using web-sockets in between..
Anyways thanks for your time and sympathy once again..
Can't find what you're looking for? Ask the community or share your knowledge.