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

0 Members and 1 Guest are viewing this topic.

BlackBox

  • Water Moccasin
  • Posts: 2306
Civil 3D Styles | Created By
« on: March 19, 2012, 04:21:55 pm »
Does anyone know if the 'Created By' value is stored somewhere, or if it is programmatically brought in at the time a new style is being created?

I am trying to set that for our company name, and am trying to see if this can be done in SysVar/Registry, etc. of if needs to be done programmatically after being created (.NET?), thanks.
"Potential has a shelf life." - Margaret Atwood

Jeff_M

  • Gator
  • Posts: 3303
  • C3D user & customizer
Re: Civil 3D Styles | Created By
« Reply #1 on: March 19, 2012, 05:15:26 pm »
The default "Created By" is merely the user login name. It can be changed during style creation, and the value is accessible through the .NET API so it can be changed programatically as well.

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #2 on: March 19, 2012, 05:17:42 pm »
... I had a feeling this would be relegated to a .NET solution.

Thanks for the clarification, Jeff
"Potential has a shelf life." - Margaret Atwood

mjfarrell

  • Needs a day job
  • Posts: 9915
  • Every Student their own Lesson
Re: Civil 3D Styles | Created By
« Reply #3 on: March 19, 2012, 09:20:57 pm »
I am wondering why one would expend the energy to do this?

Are people filching your styles?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #4 on: March 20, 2012, 12:17:39 am »
Corporate directive... All styles are to have company name as 'Created by'. I'm actually just trying to save myself from having to do this manually, for each, and every, single, stinking, style. LoL
"Potential has a shelf life." - Margaret Atwood

mjfarrell

  • Needs a day job
  • Posts: 9915
  • Every Student their own Lesson
Re: Civil 3D Styles | Created By
« Reply #5 on: March 20, 2012, 01:38:46 am »
Corporate directive... All styles are to have company name as 'Created by'. I'm actually just trying to save myself from having to do this manually, for each, and every, single, stinking, style. LoL
Someone (not you) needs to worry about more important things.....
Like serving the client needs and getting the jobs submitted on time.

The person requesting this obviously has nothing to do, if they are micromanaging to this extent.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

huiz

  • Bull Frog
  • Posts: 480
  • Certified Prof C3D
Re: Civil 3D Styles | Created By
« Reply #6 on: March 20, 2012, 02:22:53 am »
It is reasonable to have a business template with styles named according business names convention. Also creation names can be set to a business name instead of pointing to one (or more) persons. It can look quite messy to have several names, even those who already left the company.

In case of drawings or projects it can be handy to see who created or edited styles, so in these drawings it is good to leave the names of the creators/editors.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

mjfarrell

  • Needs a day job
  • Posts: 9915
  • Every Student their own Lesson
Re: Civil 3D Styles | Created By
« Reply #7 on: March 20, 2012, 03:14:19 am »
I'm not saying there should not be a naming convention applied to styles.

I am saying there is no value added to the client or the company, in expending any energy in setting the created by name. 
Be your Best


Michael Farrell
http://primeservicesglobal.com/

alanjt

  • Needs a day job
  • Posts: 4670
  • Standby for witty remark...
Re: Civil 3D Styles | Created By
« Reply #8 on: March 20, 2012, 07:49:43 am »
I'm with you on this one, Michael.
Civil 3D 2011|2012 ~ Windohz 7
Dropbox

Jeff_M

  • Gator
  • Posts: 3303
  • C3D user & customizer
Re: Civil 3D Styles | Created By
« Reply #9 on: March 20, 2012, 01:06:03 pm »
While I agree that this is micro-managing to the extreme, I can see a benefit for at least having the styles in a company template all set to the same 'created by' name. So attached is a ZIP file with a .NET dll that can be netloaded and run the command CREATEDBYUPDATE. You will be prompted for a new name then all styles in the drawing will be updated with the new value for "Created By:".

Anyone wanting the source code, just let me know. It is essentially the sample code for C3D provided in the Samples folder with some alterations. Works in C3D2010-2012.


huiz

  • Bull Frog
  • Posts: 480
  • Certified Prof C3D
Re: Civil 3D Styles | Created By
« Reply #10 on: March 20, 2012, 02:18:06 pm »
Although I understand why people think this is not worth putting time in it, I believe that doing things nice, clean and neat with just the little things, it will help you be nice, clean and neat with the big things.

If you don't see any value in a nice business template, do you like naming conventions?

Or are you not interested in putting things in different layers?

Are you one of those people who don't care much about updating geometry, if one can update the dimension as well?

Or what about file naming, like "design today.dwg", "version 2 (1).dwg", "version 2 better.dwg", etc.

And there are people who don't comment code and name every control just Textbox1, Textbox2, Button1, etc (probably not on this forum)  :? :)


On the other hand, not everybody should be a hair-splitter  8) Just be effective with a little sense of tidiness... But I do like having a nice business template.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

alanjt

  • Needs a day job
  • Posts: 4670
  • Standby for witty remark...
Re: Civil 3D Styles | Created By
« Reply #11 on: March 20, 2012, 02:23:40 pm »
I am a stickler for naming convention with styles, but the created by portion never phased me.
Civil 3D 2011|2012 ~ Windohz 7
Dropbox

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #12 on: March 20, 2012, 05:08:59 pm »
Too many posts to quote 'em - put simply, this stems from two main factors...

1) I'll use the analogy that my employer provides +/-80% of what we need by way of best practices, templates, etc. that is to be used as a starting point, given that we're +11K employee international firm. The rest is a free for all, and is up to us regional CAD Admins to work out in accordance with our client's, and regional standards in mind, based on the intent provided. Ergo, every region (may?) have a slightly different style (pun intended).

2) Corporate (despite being comprised of Canadians) is unable to locate the letter "I" in the word "Team," thus we (regional CAD Admins) shall do as they wish-aye... keeping track of who has created what will be done via the Modified property.

While I agree that this is micro-managing to the extreme, I can see a benefit for at least having the styles in a company template all set to the same 'created by' name. So attached is a ZIP file with a .NET dll that can be netloaded and run the command CREATEDBYUPDATE. You will be prompted for a new name then all styles in the drawing will be updated with the new value for "Created By:".

Anyone wanting the source code, just let me know. It is essentially the sample code for C3D provided in the Samples folder with some alterations. Works in C3D2010-2012.

Jeff - Just downloaded this, will give it a look-see after hours. I really appreciate your help!

Cheers! :beer:
"Potential has a shelf life." - Margaret Atwood

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #13 on: March 20, 2012, 05:23:55 pm »
FWIW -

Tested the .DLL in 2011 (both network, and local netload) and all result in fatal error. I made sure to unblock the .ZIP first. 2012 worked like a charm.
"Potential has a shelf life." - Margaret Atwood

alanjt

  • Needs a day job
  • Posts: 4670
  • Standby for witty remark...
Re: Civil 3D Styles | Created By
« Reply #14 on: March 20, 2012, 05:29:41 pm »
Worked for me in 2011.
Civil 3D 2011|2012 ~ Windohz 7
Dropbox

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #15 on: March 20, 2012, 06: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.
"Potential has a shelf life." - Margaret Atwood

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #16 on: March 20, 2012, 08: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.
"Potential has a shelf life." - Margaret Atwood

Jeff_M

  • Gator
  • Posts: 3303
  • C3D user & customizer
Re: Civil 3D Styles | Created By
« Reply #17 on: March 20, 2012, 11:58:34 pm »
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

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #18 on: March 21, 2012, 12:25:50 am »
Thanks for the guidance, Jeff; I'll check that out tomorrow during lunch. You've been most helpful.
"Potential has a shelf life." - Margaret Atwood

Jeff_M

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

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #20 on: March 27, 2012, 09: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!
"Potential has a shelf life." - Margaret Atwood

BlackBox

  • Water Moccasin
  • Posts: 2306
Re: Civil 3D Styles | Created By
« Reply #21 on: March 31, 2012, 04: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, 05:24:04 pm by RenderMan »
"Potential has a shelf life." - Margaret Atwood

sinc

  • Gator
  • Posts: 3124
  • I think I cad...
Re: Civil 3D Styles | Created By
« Reply #22 on: April 12, 2012, 10: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.
-- Sinc
Civil-3D 2012
http://www.ejsurveying.com
http://www.quuxsoft.com
Unleash Civil-3D with the Sincpac-C3D!