Author Topic: Creating anonymous groups ...  (Read 6379 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Creating anonymous groups ...
« on: February 20, 2008, 10:53:19 PM »
Small tip in the remote chance someone doesn't know ... the add method of the groups collection supports anonymous group name creation --

Code: [Select]
[color=green];; simple function definition 'cause I be lazy[/color]

(defun _CreateAnonymousGroup ( )
    (vla-add
        (vla-get-groups
            (vla-get-activedocument
                (vlax-get-acad-object)
            )
        )
        "*"
    )
)

[color=green];; 'Kay, let's make a group[/color]

(setq myGroup (_CreateAnonymousGroup))

[color=maroon]#<VLA-OBJECT IAcadGroup 107be154>[/color]

[color=green];; Assuming we had a couple objects associated with some
;; variables, namely lineObject, arcObject and circleObject
;; respectively, adding them to the newly made group is a
;; snap:[/color]

(vlax-invoke
    myGroup
   'AppendItems
    (list lineObject arcObject circleObject)
)

[color=green];; Let's see what our group hosts[/color]

(vlax-for object myGroup
    (print
        (mapcar
           '(lambda ( property ) (vlax-get object property))
           '(ObjectName Handle)
        )           
    )
    (princ)
)

[color=maroon]("AcDbLine" "1AF")
("AcDbArc" "1B0")
("AcDbCircle" "1B1")[/color]

[color=green];; What's the name of our group?[/color]

(vla-get-name myGroup)

[color=maroon]"*A1"[/color]

[color=green];; For what it's worth ...[/color]

:)
« Last Edit: February 21, 2008, 07:31:59 AM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

KewlToyZ

  • Guest
Re: Creating anonymous groups ...
« Reply #1 on: February 20, 2008, 11:14:37 PM »
I knew there had to be something useful for the serialization in groups.
I haven't been able to employ them with use over my clients broad diversity though.
Of course that could be my own oversight neglecting them.
Thanks for getting my wheels turning MP!

I just wish I could figure out how to put the tool palettes need for serializing over a network to good use.
So far the only thing I have found is that I can't run backup software for mirroring them between sites, blows out all of the palettes to a 0 KB file with AD permissions and read only attributes set.
Really makes my head hurt, of course with a head like mine if it didn't hurt then nature is wrong  :ugly:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Creating anonymous groups ...
« Reply #2 on: February 21, 2008, 04:34:07 AM »

Quote from:  MP the humble

;; ..........
];; For what it's worth ...

Interestingly, I enjoyed the formatting as much as the code ..
that probably says something about each of us :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Creating anonymous groups ...
« Reply #3 on: February 21, 2008, 08:57:26 AM »
Thanks KB; indeed. :)

Can't help you out KT, I've not done anything with tool pallets (yet). :(
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

KewlToyZ

  • Guest
Re: Creating anonymous groups ...
« Reply #4 on: February 22, 2008, 07:49:28 PM »
No sweat MP, its a direct issue in the Applications design.
They need to separate Content Browser items for AEC libraries from standard block Palette handling for starters.
I have some suspicions it may be easier with the new strip replacing the dashboard.
Currently Palettes are a pain to handle updating but fairly easy to build.
The Content Browser is just too cludgy and doesn't import and export as nearly well as they claim either for shared content.
Networked items can really bog a system down when they reach these volume sizes as well.

So more or less there needs to be a centralized system created by the enterprise trying to maintain their libraries as local installations.
I've been contemplating local installations of the systems and creating an update utility through the company intranet that runs a file version check. Have it delete the desktop icon and replace it with another pointing to the new profile-Update-ID-##.##.arg
With the actual profile name changing the ID # this creates a new profile seamlessly without the user really having to worry too much.
The problem is capturing some more or less arbitrary preferences and retaining them it proves difficult because Engineers love to tweak and get miffed when their tweaks get wiped. I try to enforce people to save their workspaces, but I still have old school types that have to fight the system, create their own profiles then whine when it isn't working right. I don't have time to crawl into their workspaces with a microscope to trace a bug when I can blow out the profile, retain their workspace, and it works like everyone elses in one command.

Wow I just noticed I'm a Bullfrog, kewl!
I'll have to keep it a secret or the girlfriends going to make demands on my new tongue....
« Last Edit: February 22, 2008, 07:53:20 PM by KewlToyZ »

Joe Burke

  • Guest
Re: Creating anonymous groups ...
« Reply #5 on: February 23, 2008, 08:54:05 AM »
Personally I think ranking members in terms of number of posts is nonsense.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Creating anonymous groups ...
« Reply #6 on: February 23, 2008, 09:04:10 AM »
I believe that's why they are whimsical here & not intended for any real measure.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Creating anonymous groups ...
« Reply #7 on: February 23, 2008, 09:58:50 AM »
Wonder why this chokes ACAD2000?

Code: [Select]
_$ (defun _CreateAnonymousGroup ( )
    (vla-add
        (vla-get-groups
            (vla-get-activedocument
                (vlax-get-acad-object)
            )
        )
        "*"
    )
)
_CREATEANONYMOUSGROUP
_$ (setq myGroup (_CreateAnonymousGroup))
; error: Automation Error. Invalid argument Name in Add method
_1$
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Creating anonymous groups ...
« Reply #8 on: February 23, 2008, 10:15:22 AM »
Guessing AutoCAD 2000 didn't support anonymous group creation.

Try it after defining the error handler: (defun *error* (msg) (vl-bt)).

(Code I posted was developed using AutoCAD 2008).

{shrug}
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Creating anonymous groups ...
« Reply #9 on: February 23, 2008, 11:04:41 AM »
Code: [Select]
_$ (setq myGroup (_CreateAnonymousGroup))
Backtrace:
[0.186] (VL-BT)
[1.182] (*ERROR* "Automation Error. Invalid argument Name in Add method") LAP+7
[2.176] (_call-err-hook #<USUBR @06179ec4 *ERROR*> "Automation Error. Invalid argument Name in Add method")
[3.170] (sys-error "Automation Error. Invalid argument Name in Add method")
:ERROR-BREAK.165 "Automation Error. Invalid argument Name in Add method"
[4.162] (intelligent-invoke #<VLA-OBJECT IAcadGroups 01e38cd4> "Add" 1 "*")
[5.154] (#<SUBR @0347521c vlax-invoke-method> #<VLA-OBJECT IAcadGroups 01e38cd4> "Add" "*")
[6.148] (vla-Add #<VLA-OBJECT IAcadGroups 01e38cd4> "*")
[7.142] (_CREATEANONYMOUSGROUP) LAP+34
[8.137] (#<USUBR @05e86370 -top->) LAP+8
[9.133] (al-top-funcall #<USUBR @05e86370 -top->)
[10.128] (alide-load-stream #<FILE internal> T)
[11.122] (al-load-stream #<FILE internal> T)
[12.116] (#<SUBR @040cb4d8 -unwind-protect->)
[13.113] (rep-cntx.apply #<rep-cntx :AUTOLISP> al-load-stream (#<FILE internal> T))
[14.106] (rep-cntx.sys-str-top nil #<rep-cntx :AUTOLISP> "(setq myGroup (_CreateAnonymousGroup))")
[15.99] (sys-str-top #<rep-cntx :AUTOLISP> "(setq myGroup (_CreateAnonymousGroup))")
[16.93] (console.terminal-entered! (terminal.terminal-entered!) #<console "Visual LISP Console">)
[17.87] (terminal-entered! #<console "Visual LISP Console">)
[18.82] (!accept-enter #<console "Visual LISP Console">)
[19.77] (#<SUBR @040cb4d8 -unwind-protect->)
[20.74] (rep-cntx.apply #<rep-cntx :AUTOLISP> #<SUBR @04186690 !accept-enter> (#<console "Visual LISP Console">))
[21.67] (rep-cntx.funcall #<rep-cntx :AUTOLISP> #<SUBR @04186690 !accept-enter> #<console "Visual LISP Console">)
:TOP-COMMAND.60 (((:USER-INPUT "(setq myGroup (_CreateAnonymousGroup))")) "(setq myGroup (_CreateAnonymousGroup))")
[22.57] (#<SUBR @04208370 _sys-top-loop>)
[23.54] (_catched-apply (#&13) #<SUBR @04208370 _sys-top-loop> nil)
[24.47] (sys-top)
[25.43] (#<SUBR @03517960 -callback-envelope->)
:CALLBACK-ENTRY.40 (:CALLBACK-ENTRY)
[26.37] (#<SUBR @035179c4 -unwind-protect->)
[27.34] (_lisplet-apply #<Document-LISPLET> #<SUBR @03517960 -callback-envelope-> nil :CALLBACK-ENTRY)
[28.26] (_lisplet-callback-apply #<Document-LISPLET> sys-top nil)
[29.19] (C:VLIDE)
[30.15] (#<SUBR @06179eb0 -rts_top->)
[31.12] (#<SUBR @03512334 veval-str-body> "(C:VLIDE)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
_1$


This works just fine. Go figure. :-(
Code: [Select]
Command: -group
Enter a group option
[?/Order/Add/Remove/Explode/REName/Selectable/Create] <Create>: c

Enter a group name or [?]: *
Enter a group description: anon

Select objects: Specify opposite corner: 3 found

Select objects:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Creating anonymous groups ...
« Reply #10 on: February 23, 2008, 11:47:52 PM »
Don't know what to tell you Alan; all I know is it works in 2008. :( I'll try it Monday under 2005.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Creating anonymous groups ...
« Reply #11 on: February 24, 2008, 12:11:43 AM »
Works in  2004 :?
So don't waste you time.. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Creating anonymous groups ...
« Reply #12 on: February 24, 2008, 12:15:13 AM »
Thanks for letting me know. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

KewlToyZ

  • Guest
Re: Creating anonymous groups ...
« Reply #13 on: February 26, 2008, 01:30:14 AM »
Personally I think ranking members in terms of number of posts is nonsense.
True, for sure you guys freak me out with your background knowledge at times.
Thanks for your insights! Always makes my day seem a little less ambiguous trying to figure out where and how you found the time to go this deep. Trying to get to a point of really knowing where these library references come from and when to use them is quite a few years away. I couldn't even begin to try and think otherwise. Concepts are one thing, application is what chills people to the bone. You gents rock!