TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: deegeecees on October 04, 2005, 03:47:31 PM

Title: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 03:47:31 PM
I'm stuck:

Code: [Select]
(defun prof_comed_out ()
(setq profilename1 (strcat "ComEd_" cad_ver "_" use1))
(setq profilepath1 (strcat "\\\\lisledc2\\projectscomed\\std\\acad\\profiles\\" profilename1 ".arg"))
(setq NewProfile1 (vlax-invoke-method acadprofiles1 'ExportProfile profilepath1))
)

Returns this:

Code: [Select]
Command: (prof_comed_out) ; error: bad argument type: VLA-OBJECT nil

I just need a little nudge in the right direction.


Notes:

1. cad_ver = Version (15, 16 etc.)
2. use1 = loginname

These are defined before prof_comed_out.
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 04:00:51 PM
Little nudge: Where is acadprofiles1 being set?
Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 04:03:58 PM
I see...

Code: [Select]
(setq acadprofiles (vla-get-profiles (vla-get-preferences (vlax-get-Acad-Object))))
Thought that might work, but to no avail.

Hold The Phone...!

Code: [Select]
(setq acadprofiles1 (vla-get-profiles (vla-get-preferences (vlax-get-Acad-Object))))
Now returns:

Quote
Command: (prof_comed_out) ; error: too few actual parameters
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 04:14:53 PM
Couple nudges ...

How many arguments does the ExportProfile method expect?

Code: [Select]
(vlax-dump-object
    (setq profiles
        (vla-get-profiles
            (vla-get-preferences
                (vlax-get-acad-object)
            )
        )
    )
    t
)

Quote from: Result
; IAcadPreferencesProfiles: This object contains the options from the Profiles tab on the Options dialog
; Property values:
;   ActiveProfile = "BanR2002"
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00b07a68>
; Methods supported:
;   CopyProfile (2)
;   DeleteProfile (1)
;   ExportProfile (2) Hmmm, requires 2 arguments. Wonder what they are ...
;   GetAllProfileNames (1)
;   ImportProfile (3)
;   RenameProfile (2)
;   ResetProfile (1)

Quote from: VBA Help
ExportProfile

Exports the active profile so it can be shared with other users.

Signature

object.ExportProfile Profile, RegFile

Object = The object or objects this property applies to, like PreferencesProfiles.

Profile = String; input-only. The name of the profile to be exported.

RegFile = String; input-only. The name of the file the profile will be exported to. The extension of the file should be .arg.


:)
Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 04:22:59 PM
Code: [Select]
(setq NewProfile1 (vlax-invoke-method acadprofiles1 'ExportProfile profilename1 profilepath1))
(2) arguments

Quote
Profile = String; input-only. The name of the profile to be exported.
RegFile = String; input-only. The name of the file the profile will be exported to. The extension of the file should be .arg.

THAT doesn't work... <headscratch.wav> :?
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 04:32:14 PM
Are you passing the name of a valid (existing) profile and a valid path for the output?
Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 04:37:59 PM
 :ugly:

I wasn't seeing that. Thanks MP, I've got something to work with now.
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 04:38:57 PM
Are you sure it's not working? The call doesn't return anything unless it tosses a wobbly.

Check the target file of your export -- does it exist? Does the date / time stamp correlate?
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 04:39:55 PM
Ya guud.
Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 04:49:01 PM
Task:

Multiple clients, each with their own standards, are a part of everyday business here. I'm giving the drafters the ability to click on a button and have the appropriate menus/support available with a profile. The problem is that when the user modifies this profile, and switches to a different client profile, then back again, the customization is lost. My solutioon is to start them out with a default, then they have the option to save it that way (through another button click) with their user login tacked on the end of the name of the default. When the user switches back to that client, the macro searhes for this profile, if not found, revert to default.
Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 04:50:12 PM
Sorry, typing...

Oh yeah, all guuud. Thanks again!  :-)
Title: Re: Vlisp Export Profile
Post by: MP on October 04, 2005, 05:00:41 PM
Happy to help DeeGee ...

I do a similar thing, though I drive it all via a database front ended by a little vb app.

Title: Re: Vlisp Export Profile
Post by: deegeecees on October 04, 2005, 05:08:50 PM
I'm not allowed to devote THAT much time to it, so I gotta get it done with minimal programming time. The last time I took on a database project, I spent 6 months. By the time my boss figured to ask me about it, I was too far into it to stop. I learned ALOT from that one. Sequel and Access are like fingernails on a blackboard to me to this day.
Title: Re: Vlisp Export Profile
Post by: KewlToyZ on October 22, 2007, 01:19:16 PM
I know it has been awhile but:
Code: [Select]
(defun C:repair ()
(vla-exportprofile
     (vla-get-profiles
       (vla-get-preferences
         (vlax-get-acad-object)
       )
     )
     "MEP"
     "C:\\_KTA MEP\\MEP.arg"
)

(princ "Updating Current Profile.....")
(print "Current Profile Update Complete.")
)

How would I rename the profile ?
I want to control updates to the registry reference by directing it to a profile in another location.
The only way to do it is to rename the current instance of that profile.
Title: Re: Vlisp Export Profile
Post by: KewlToyZ on October 22, 2007, 02:23:06 PM
ok...duhhhhh  :ugly:

Code: [Select]
(vla-renameprofile
     (vla-get-profiles
       (vla-get-preferences
         (vlax-get-acad-object)
       )
     )
     "MEP"
     "MEP-Remove"
  )
Title: Re: Vlisp Export Profile
Post by: KewlToyZ on October 22, 2007, 02:49:03 PM
But I am missing where to set it current... time to do a search