TheSwamp
Code Red => .NET => Topic started by: Andrey Bushman on September 20, 2012, 04:54:10 AM
-
Hi all.
I think this is my next a quickly dying topic... :(
Run "_standards" command in AutoCAD command line. The "Configure Standards" dialog will be opened. You can to Add/Remove/Move_Up/Move_Down the DWS files on "Standards" tab. And you can check/uncheck items on "Plug-ins" tab.
How can I do such operations via AutoCAD .NET API? I need detailed examples, please.
Regards
-
Damn Andrey, I'm starting to think you just sit around all day thinking up API questions that have never been discussed. I hope you eventually get answers to all your posts for the benefit of this entire forum but until then your way out of my league in creating new AutoCAD utilities. :wink:
-
I'm starting to think you just sit around all day thinking up API questions that have never been discussed.
You are mistaken. I was surprised by your opinion. Standardization is very important for the any company. Often it is necessary to process a large count of files, therefore possibility of programmed control is very important for us.
but until then your way out of my league in creating new AutoCAD utilities.
I didn't understand this phrase.
-
It was a while back and would need to remeber where some info for it is, but you reference AcStMgr.dll and implenemnt the IAcStPlugin2 interface, I think, and seems like there were methods in interface that were never used among other things
-
It was a while back and would need to remeber where some info for it is, but you reference AcStMgr.dll and implenemnt the IAcStPlugin2 interface, I think, and seems like there were methods in interface that were never used among other things
I understood at the past (https://sites.google.com/site/bushmansnetlaboratory/sendbox/stati/checkstandard) how to use IAcStPlugin2, but development of the standards module is other topic.
-
Standardization is important for us too. Rather than try to force the square Standards system into the round (+/-) hole of our requirements, I built one that does what we need it to (and a few things the OOTB Standards can't).
-
Standardization is important for us too. Rather than try to force the square Standards system into the round (+/-) hole of our requirements, I built one that does what we need it to (and a few things the OOTB Standards can't).
It is interesting. Can I familiarize myself with this material, or is it the secret information?
-
Standardization is important for us too. Rather than try to force the square Standards system into the round (+/-) hole of our requirements, I built one that does what we need it to (and a few things the OOTB Standards can't).
We did the same thing. This works well for us, way better than the OOTB standards checker.
Andrey, I might suggest you gather your information and break it down by tasks. For example, let's take layers. Obviously you need a listing (array) of what layers are allowed. Next take a drawing and compare it to this list (Iterate the layer table passing each item through the array). Decide what to do if your program finds a layer that does not match your array of layers (Correct, denote, ignore, etc...).
This same idea will work with Text Styles, Blocks, Dim Styles, linetypes, among other things. Good luck!
-
This works well for us, way better than the OOTB standards checker.
Andrey, I might suggest you gather your information and break it down by tasks. For example, let's take layers. Obviously you need a listing (array) of what layers are allowed. Next take a drawing and compare it to this list (Iterate the layer table passing each item through the array). Decide what to do if your program finds a layer that does not match your array of layers (Correct, denote, ignore, etc...).
This same idea will work with Text Styles, Blocks, Dim Styles, linetypes, among other things. Good luck!
Yes, I have thought about this, thank you.
But... What about current topic? For example: I want to disconnect already connected standards. :)
-
Standardization is important for us too. Rather than try to force the square Standards system into the round (+/-) hole of our requirements, I built one that does what we need it to (and a few things the OOTB Standards can't).
It is interesting. Can I familiarize myself with this material, or is it the secret information?
The general layout I use is to store the data in XML files, using XSD schema to assist changes via Intellisense and XSL stylesheets to dynamically display the data in HTML tables (self-documenting standards - no more typing everything out TWICE!).
The dotNET standards DLL uses an abstract base class to build the basics of how to handle a standard, and inerits it to each of the different "areas" that need handling e.g. layers, line types, text styles, and so on. It also includes some versioning controls to ensure the latest data is being used without needlessly importing the entire set of data every time a drawing is opened. In my existing structure I've already got the code hooks for setting (add if needed) standards, getting (throwing up, or returning active if missing), adding, updating, and batch-adding. The hooks are there for both the dedicated standards controls for add/update/remove/all standards, as well as being called frequently in programs for inserting blocks, text, changing object layers, and all sorts of other "stuff".
-
>dgorsman
Thank you.
-
I'm starting to think you just sit around all day thinking up API questions that have never been discussed.
You are mistaken. I was surprised by your opinion. Standardization is very important for the any company. Often it is necessary to process a large count of files, therefore possibility of programmed control is very important for us.
but until then your way out of my league in creating new AutoCAD utilities.
I didn't understand this phrase.
Andrey, I was joking about the questions you have been bringing up in these forums. They seem to be on the fringes of the API. No disrespect to you or towards keeping standards. I think your questions are helping extend everyone's knowledge of the API.
That being said, we also use a XML file to keep our standards in. Although I'm in the process now of changing these files over to binary files, created by serialization, since we have some users that cant stop making changes in a text editor and leaving brackets or quotations out.
-
Andrey, I was joking about the questions you have been bringing up in these forums. They seem to be on the fringes of the API. No disrespect to you or towards keeping standards. I think your questions are helping extend everyone's knowledge of the API.
Thank you. :)
That being said, we also use a XML file to keep our standards in. Although I'm in the process now of changing these files over to binary files, created by serialization, since we have some users that cant stop making changes in a text editor and leaving brackets or quotations out.
I think this problem can be decided differently. For example, you can have serialized a settings like a recovery copy. Your program can check XML valid for syntax and XSD schema before using this XML file. If XML file is invalid then file will removed and created new XML file from serialized recovery copy.
User can comfortably read your XML file via browser if you use XML + XSD + XSLT. I can show the detailed examples by this method via AutoCAD plugins wrapper (if this are interesting for you).
-
Interesting discussion.
I am curious to know why though, so many choose to employ .XML?
I was directed to use this for my night job a while back for a development project... According to this (albeit older) material (http://www.codeproject.com/Articles/5304/Read-Write-XML-files-Config-files-INI-files-or-the) from CodeProject, .XML is slower than both Registry, and .INI, and only faster than .Config.
-
I actually started with a CFG/INI -type file (registry was out of the question - I need it centrally located, not per computer). Compared to that, XML is well understood; easy to read; syntactically enforceable (OK, made up phrase :angel: ) with XSD schema; and readily searchable through XPath epressions (try summing a select set of values from a CFG without getting tied in knots...). I don't have proof, but I can't see our XML data files running any slower than the previous CFGs; in a number of cases for other data file I can for certain say its faster. That may not be true for a simple configuration which has a mere handful of values to track.
-
As always, I greatly appreciate the clarification/education, dgorsman. :-)
-
Interesting discussion.
I am curious to know why though, so many choose to employ .XML?
I was directed to use this for my night job a while back for a development project... According to this (albeit older) material (http://www.codeproject.com/Articles/5304/Read-Write-XML-files-Config-files-INI-files-or-the) from CodeProject, .XML is slower than both Registry, and .INI, and only faster than .Config.
If you use XML, then you can:
1. To check your data (XML file) for correct structure and a contain. You can do it via your XSD schema.
2. To display your XML data as any format, for example: html, pdf, svg, csv, e.t.c. You can do it via your XSLT files.
3. To manage XML data - this is very simple via LINQ to XML.
Look example:
Download and unpack the attached file. This plugin was wrote by Alexander Rivilis, and I packaged it in my "AutoCAD plugin XML template". In this example I am using XML + XSLT + XSD. XSLT and XSD it is XML too :).
Open readme.html in NOTEPAD.EXE program. You will see this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD/HTML 4.01 frameset//EN"
"http://www.w3.org/TR/HTML4.01/frameset.dtd">
<html>
<head><title>readme</title></head>
<frameset rows="80,*" border="5" bordercolor="red" >
<frame name="frTitle" src="./settings/info/ReadMeHeader.xml"
scrolling="no" noresize="noresize" />
<frameset cols="200,*" border="5" frameborder="1">
<frame name="frContents" src="./settings/info/content.xml"/>
<frame name="frDocument" src="./settings/info/appinfo.xml"/>
</frameset>
</frameset>
</html>
You can see the different XML files, which are used like data for this HTML file. Now open readme.html in Internet Explorer, or Opera browser. You will see clear documentation about this AutoCAD plugin.
Notes: You can open readme.html file in Google Chrome too, but with --allow-file-access-from-files option only. Firefox displayed incorrect the formating of this files.
The XML using allowed to me to manage all AutoCAD plugins in my company. And I do it not manually, but program. The old video by this theme you can see here (http://www.youtube.com/watch?v=M8Mk9VHC9Yc), I apologize, but this video on Russian language only.
Then my special program works with such "XML wrapped" plugins and controls their autoload to AutoCAD (any versions). It is convenient for me and my users:
(http://forum.dwg.ru/attachment.php?attachmentid=80769&stc=1&d=1337716953)
(http://forum.dwg.ru/attachment.php?attachmentid=80770&stc=1&d=1337716986)
XML provides me actual dynamic help for all AutoCAD plugins, and gave to me keywords for the search. The XML is very convenient and gives many possibilities. All that I showed, I made by means of XML. These are my old example, but it is possible to understand the main sense of use of XML.
=========
P.S. I apologise for my bad English.
Regards
-
P.S. I apologise for my bad English.
No worries; your English is superior to my Russian. ;-)
Thank you for your generous reply, I will look over the material you posted.