Author Topic: Civil 3D Styles | Created By  (Read 7952 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Created By
« Reply #15 on: March 20, 2012, 07:12:39 PM »
Worked for me in 2011.

... Hrm. I didn't even include it in my list of .DLL's which are net loaded at startup either - I manually netloaded, browsed, etc. I'll try it on 2011 again next time I log in.
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Created By
« Reply #16 on: March 20, 2012, 09:23:51 PM »
Well, my problem with not working in 2011 was the modified acad.exe.Config I've been testing. I followed Kean's template to allow me to load from remote sources; and this worked well, without any noticeable issues (until now).

Enabling load from remote sources is something I am hoping to retain, moving forward, but I'll have to seek some education on acad.exe.Config in another thread (off topic).

Jeff - could you point me toward the (ObjectARX?) SDK sample code you mentioned earlier? There are several style related items I'm wanting to develop, and am just now digging into this aspect of the API.
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Civil 3D Styles | Created By
« Reply #17 on: March 21, 2012, 12:58:34 AM »
Jeff - could you point me toward the (ObjectARX?) SDK sample code you mentioned earlier? There are several style related items I'm wanting to develop, and am just now digging into this aspect of the API.
C:\Program Files\Autodesk\AutoCAD Civil 3D 2011\Sample\Civil 3D API\DotNet\CSharp\CompareStyles There are a few others in the same CSharp folder.

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Created By
« Reply #18 on: March 21, 2012, 01:25:50 AM »
Thanks for the guidance, Jeff; I'll check that out tomorrow during lunch. You've been most helpful.
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Civil 3D Styles | Created By
« Reply #19 on: March 27, 2012, 10:48:10 AM »
Posting updated zip file with minor change to trap error thrown when a style collection has not been initialized.

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Created By
« Reply #20 on: March 27, 2012, 10:51:55 AM »
Posting updated zip file with minor change to trap error thrown when a style collection has not been initialized.

Fantastic job - and thanks for the source code, Jeff!
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Created By
« Reply #21 on: March 31, 2012, 05:20:41 PM »
Just as an update, I've taken Jeff's code (thanks again!) and slightly revised the CommandMethod to suite our use, and I am posting it here in the event that others may be interested.

In short, I revised the Prompt*Options to allow me to incorporate a Keyword (our company name), which allows the user to simply Enter, rather than manually typing out the company name each-and-every-time a change is made.

Also, a special thanks to Hallex (aka Oleg), for his suggestion of using *.Keywords.AllowArbitraryInput = true; as a work around to allowing 'string' input, and Keyword options in this post.

Here's the code, note the 'companyName' variable at the top of the Class... Simply change this value to your company name and recompile:

Code - C#: [Select]
  1.         [CommandMethod("StylesCreatedBy")]
  2.         public static void StylesCreatedBy()
  3.         {
  4.             //
  5.             // Company name as string, to be used as default prompt option
  6.             //
  7.             String companyName = "SomeCompany"; //<-- Your company name goes here
  8.             //
  9.             Document acDoc = Application.DocumentManager.MdiActiveDocument;
  10.             CivilDocument civDoc = CivilApplication.ActiveDocument;
  11.  
  12.             PromptKeywordOptions myOpts = new PromptKeywordOptions("");
  13.             myOpts.Message = "\nEnter new value for 'Created By' in all styles or: ";
  14.  
  15.             // Define the valid keywords, specify default as 'companyName',
  16.             // and allow arbitrary input (spaces not accepted)
  17.             myOpts.Keywords.Add(companyName);
  18.             myOpts.Keywords.Default = companyName;
  19.             myOpts.AllowArbitraryInput = true;
  20.            
  21.             PromptResult myRes = acDoc.Editor.GetKeywords(myOpts);
  22.  
  23.             if (myRes.Status != PromptStatus.OK)
  24.                 return;
  25.             using (tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
  26.             {
  27.                 creator = myRes.StringResult;
  28.                 ListRoot(civDoc.Styles);
  29.                 tr.Commit();
  30.             }
  31.         }
  32.  

Cheers! :beer:

** Edit - Separately, I'd just like to point out how disappointed I am that .NET does not have an equivalent for:

Code: [Select]
_$ (setq var (getstring T "\nEnter a string or [Small/Medium/Large] <Large>: "))
"Something Else"
_$

... The idea of disallowing Keyword entry with GetString() Method is idiotic.

/vent
« Last Edit: March 31, 2012, 06:24:04 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

sinc

  • Guest
Re: Civil 3D Styles | Created By
« Reply #22 on: April 12, 2012, 11:09:54 PM »
For the record, I tend to agree with MJFarrell and alanjt... I see no value in the "created by" field.

I suspect it was created by some misguided employee at Autodesk who wanted to flag the Autodesk-created styles as coming from them.  Or more-likely, some big beta-tester in one of the early versions of C3D, who told Autodesk that they wanted to tie their Styles to their company.

I personally view all of this as a moot point, and more like what happened with Blocks.  At one point, a lot of companies wanted to tie their Blocks to themselves.  Now everyone shares Blocks freely, and life is MUCH better for everyone involved.  It's possible to get "too possessive", and I think that's what's going on right now with C3D Styles.  Hopefully we get some sanity again soon.