Author Topic: Configure Standards via .NET  (Read 5999 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Configure Standards via .NET
« 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

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Configure Standards via .NET
« Reply #1 on: September 20, 2012, 07:48:38 AM »
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:
Revit 2019, AMEP 2019 64bit Win 10

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #2 on: September 20, 2012, 08:20:26 AM »
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.
« Last Edit: September 20, 2012, 09:03:33 AM by Andrey »

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Configure Standards via .NET
« Reply #3 on: September 20, 2012, 09:08:14 AM »
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
 

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #4 on: September 20, 2012, 09:16:11 AM »
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 how to use IAcStPlugin2, but development of the standards module is other topic.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Configure Standards via .NET
« Reply #5 on: September 20, 2012, 10:13:13 AM »
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).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #6 on: September 20, 2012, 10:18:55 AM »
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?
« Last Edit: September 20, 2012, 11:55:48 AM by Andrey »

Arizona

  • Guest
Re: Configure Standards via .NET
« Reply #7 on: September 20, 2012, 11:54:54 AM »
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!

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #8 on: September 20, 2012, 12:05:09 PM »
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. :)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Configure Standards via .NET
« Reply #9 on: September 20, 2012, 12:06:59 PM »
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".
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #10 on: September 20, 2012, 12:10:33 PM »
>dgorsman
Thank you.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Configure Standards via .NET
« Reply #11 on: September 20, 2012, 12:52:10 PM »
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.
Revit 2019, AMEP 2019 64bit Win 10

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Configure Standards via .NET
« Reply #12 on: September 20, 2012, 01:26:04 PM »
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).

BlackBox

  • King Gator
  • Posts: 3770
Re: Configure Standards via .NET
« Reply #13 on: September 24, 2012, 10:16:52 AM »
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 from CodeProject, .XML is slower than both Registry, and .INI, and only faster than .Config.



"How we think determines what we do, and what we do determines what we get."

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Configure Standards via .NET
« Reply #14 on: September 24, 2012, 10:26:57 AM »
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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}