I've developed a plug-in using the ObjectARX SDK, C# and the Autodesk plug-in templates for VS2010. The plug-in is loaded into AutoCAD at start-up via a registry entry as documented in the SDK files.
The plug-in itself is to be distributed privately and will not be submitted to the 'Marketplace' supplied by Autodesk for AutoCAD products.
I've noticed that there is a section on the AutoDesk website with regards to registering a custom prefix via the RDS scheme.
Code that differs from the default template is found within the following areas:
Namespaces e.g. "MyNamespace.Utility"
Custom Classes MyClass.cs
Custom Functions e.g. LogData()
Custom Commands e.g. "DEBUGDATA"
Based on the current implementation and intended usage/distribution method is symbol registration required? I ask as I am not sure what would happen if another plug-in used by the user has a "DEBUGDATA" command for example.
If symbol registration is required where can I find a clear example of it's implementation within code?
Many thanks
The way I try to avoid command name duplication is to use a really long command name, including my top namespace ("CadBloke" in my case) and then add a command alias to the acad.pgp file so the keyboard command is more sensible. Buttons on a toolbar etc don't care how long a command name is.
In your code, namespace clashes can certainly be an issue. I tend to make my top-level namespace pretty wordy, something like "CadBloke.CadTools.ToolName". You'd have to be pretty unlucky, or have annoyed someone, to get a clash with that sort of thing.
I saw your question on the Autodesk forum - that answer is basically the same as mine: try to make your namespace unique.
Hazy memory: I think some of the project wizards from Autodesk add your symbol to the namespace.
Here's a blog post with a link or 2 on symbol registration: http://adndevblog.typepad.com/autocad/2012/05/registered-developer-symbols.html (your link is dead, pretty typical of Autodesk as they move links around a lot). Follow that up and try & find some info on symbols. Good luck with that, I never found anything concrete. Me, I don't use it presently.
Related
Assume you have a .DLL file, and you want to know some basic information regarding it,
for example:
Is it a Managed (.NET) or Non-Managed (e.g. COM, etc) DLL
If it's Managed, what minimal version of .NET it requires
(and if it's non-managed, then any other minimal version that it requires? for example minimal version of Windows, or of something else)
Any other kind of such metadata
Please note that I am less interested in seeing the Function Headers (or Classes) that are inside.
Visual Studio's Object Browser can show the Functions/Classes very well,
yet I did not find a way to make Object Browser show the metadata that I mentioned above..
So maybe another utility can do it?
... especially in the case of Non-Dialog Containers?
Hi folks,
I want to use ActiveX controls that are created in a view, not in a Dialog container, as described in http://msdn.microsoft.com/library/191es2w5%28v=vs.100%29.aspx . But in that article, the existence of the wrapper class is already supposed / not mentioned how to generate it. In the project that was handed me over, i found such generated classes.
For Dialog-Containers, the generator runs when I add a control varaible for the embedded activeX control, (again: not mentioned in msdn doc http://msdn.microsoft.com/library/w98bewhf%28v=vs.100%29.aspx ). Workaorunds are possible (eg. creating a useless dialog just for that purpose), but there must be a "clean" way in Visual Studio!? I am a little bit disappointed by the MS-Documentation I found. If somebody could give me a hint, you could make me happy...
A word or two about project I have to make.
I have a list of products (XML formatted), and I have to make a bar code of that list.
Here are the requirements:
Technology has to be MFC, VS 2005 or VS2008
All functionality must be in one dll
Same solution should have a simple tester for the dll
I will use pdf417. http://en.wikipedia.org/wiki/PDF417 http://sourceforge.net/projects/pdf417lib/
Also, I would like to provide an interface, so that different bar codes can be implemented in future.
For example, my dll has "Write" method which is implemented in a separate file for pdf417 and in a separate file for some other bar code, so that user can choose which bar code to use.
Since I have no knowledge of mfc, I really don't know how to even start. I read some tutorials, created the dll with some dummy method, and then tried to use it in tester application, but no luck.
I know that this is a "needle in a haystack" type of a question, but if someone could help me how to setup/architect this project I would be very grateful.
Thanks,
Marko
I don't see how you benefit from using MFC if your DLL's client is not an MFC app. You are better off using a standard C interface in your exported functions if you want to support non-MFC clients. Just create a Win32 project and choose the project type as DLL, then the wizard will generate some example exported function for you. Follow the examples to create your own export functions.
I hope this is a valid question: how does intellisense work in VS2008? I'm after what is known about the algorithm it uses to find the suggestions, when exactly it pops up (the "." is just one obvious trigger), how its behavior can be modified if at all possible, etc.
To put this question into context: The main issue I'm trying to resolve is how to activate and deactivate intellisense in portions of the editor screen and how to modify where it searches to populate the suggestion box.
All information is welcome.
Take a look at this DIY Intellisense article on CodeProject.
It's more fun to reverse-engineer it, though. Let's consider the problem:
you need to identify the words of interest
you need to find the options possible
you need to present them
Now, the first step means you have to parse the code. You've got the C/C** keywords, you pre-parse the various function and class declarations, and load them into some kind of data structure. Then you parse the code and store the class, variable, etc names and put them in the same data structure.
The second step means you want a data structure which efficiently can search for a partial word and get all the words that have that prefix. You can do that with regular expressions, but that's not very efficient. An efficient data structure for that kind of search is a trie, which is discussed here on SO .
Once you have the list of possibilities, you just present it. You probably want to keep a reference to the root of the tree of possibilities so you can search them out in real time as someone types more letters.
Eclipse also has this feature and it is an open source project. Why not check out how Eclipse does it by actually looking at the code?
This question is too broad. Since there are a number of different languages the VS IDE supports out of the box AND there are N number of DSL and IDE enhancements that support alternative intellisense this implies a number of answers. If you are speaking about C# specifically then See the Tools | Options | Text Editor | C# | Intellisense area to see the available options of completion options. As far as the algorithm[s] used, you would be looking for the metadata of assemblies, copious caching of type members, MRU list for last member chosen for specific type, etc. If you have a more specific question, I'd suggest you clarify.
See the example of a DSL (ironpython) and its implementation here.
I haven't seen any text editor in VS that limits where IntelliSense shows up. It's all language specific. If your cursor is located at a point where IntelliSense might contribute to a valid token, that's when it will be used.
I believe there is some interaction with the project system being used, but that's as far as I know. I also believe there is a sample project system in the Visual Studio SDK, and that might give you an idea.
For such cases I sometimes use my own version of InteliSense that I developed for AutoHotKey when I want specific behavior. The point of this script is that it can be used with any editor, or basically any control accepting text. It works by recording text input and interpreting it upon syntax file.
You can perhaps use it as a base for the thing you want to achieve. I used ISense succesifully with several languages that don't have such thing, like Csound or even batch scripts. It will be possible to extend it to support C# using input monitoring in combination with Reflection.
Anyway, with AHK you can even control VS intelissense by "taking" the list of items it presents and filter it, or similar things. You may have some small problems with process boundaries but nothing that cant be fixed.
The intellisense ius generally, AFAIK, implemented using different methods. I read that Delphi is so fast that it implements isense by recompiling the project on each token and thats the reason C++ Builder didn't have isense as its compiling very slow.
As to your how to change where it looks question, short answer is, you can't. Intellisense for the most part is provided by reflection of assemblies included in your project ( and some other tricks with C++ ). What you are getting is a result of VS processing through all the assemblies you have included and all assemblies from the GAC.
That said, if you want to provide explicit intellisense results from a project you are working on, look into IVsContextualIntellisenseFilterProvider
Finally, for some insight into the behind the scenes process, check this blog post
Last year I wrote a Language Service for Visual Studio which added syntax highlighting for NHaml files: http://github.com/snappycode/hamleditor.
To clarify, NHaml is a html template language that can mix in code elements like an aspx file can. This plugin adds support to the IDE for editing NHaml files, but basically only adds syntax highlighting.
I was wondering if anyone knows how to add inline c# intellisense to the service like you get now in an aspx file. I'm hoping that would be possible without doing the whole c# grammar myself specific for the plugin.
Has anyone written a language service that mixes languages?
UPDATE:
It looks like the spark view engine guys have made some inroads here, I am investigating their implementation
I checked the Spark View Engine, and they seem to have made a generic ATL stuff (called SparkLanguagePackageLib), that in fact seems to be not containiag anything Spark specific. It seems to be just a generic C# intellisense library that needs the following:
The original code
The C# source that gets generated from the original code
The position mappings between the two (for example the code on line 2 pos 5 gets mapped in the output to line 4 pos 10, etc.)
Some other things, like Paintings(?)
And after that you can call:
events.OnGenerated(
primaryText, // original source code
entry.SourceCode, // generated sourcecode
cMappings, // mappings between the two
ref mappings[0], // ?
cPaints, // ?
ref paints[0]); // ?
I've tried to find Spark-specific stuff in that C++ library, but I couldn't find anything: everythig spark-related is split to a separate C# code file. I think this is good, because:
You don't need to edit the C++ files
If the spark view engine's intellisense support is installed it can be used by other view engines too
You only need to create a class, that maps between the original nhaml file and it's generated C# counterpart.
Btw. Are you still working on this NHaml Intellisense library? If not I'll try to patch their implementation in hope it can be converted to NHaml easily.
this looks like it might help
http://www.codeproject.com/KB/recipes/VSLanguageService.aspx
I finally managed to modify the code to support NHaml. It wasn't that hard at all. Unfortunately the original NHaml library doesn't support everything that was needed, so I had to create a new parser for NHaml. It doesn't support all of the constructs, but it supports most of them (enough to make NHaml programming easier)
Download: http://github.com/sztupy/nhamlsense
Screencast: http://www.youtube.com/watch?v=8jTZ2zC9eYc
You can easily add keywords by creating or modifying a usertype.dat file. Check here for some directions on attaching to specific file extentions. That might get you at least part of the way, without redoing the complete c# syntax.
(In fact, I'm not sure what you mean exactly by 'syntax highlighting' in this context. I'm sure, for instance, you get brace-match highlighting for free in the editor).