Jump to content

Need Help With Vlax Code


Recommended Posts

Guest looseLISPSsinkSHIPS
Posted

Hi,

I'm not at all familiar with the VLAX method in AutoLISP codes yet however I need the following code to run unnoticed at the start-up of AutoCAD (assuming the acad2009doc.lsp would be the best home for it)

NOTE: at current I can only copy and past the code into the commands prompt to work. Can anybody help me with this?

 

(vl-load-com)

(setq acadobject (vlax-get-Acad-Object))

(setq acadprefs (vla-get-preferences acadobject))

(setq acadprofiles (vla-get-profiles acadprefs))

(vla-put-ActiveProfile acadProfiles "P20090626A")

 

 

:huh:

Posted

Just save this as a ".lsp" file and add to "Startup Suite", at Load/Unload Applications menu(ap command)

Posted

Hi,

 

First, acad2009doc.lsp is not the best home for customized startup routines.

acad2009doc.lsp is an AutoCAD reserved file which can be edited on AutoCAD updates.

You'd rather make your own acaddoc.lsp file in a search path or use a a same named MNL file as the CUI file you're using.

 

If you want to avoid any notification at the command prompt you can make an anonymous function (lambda) which ends with a (princ) call.

 

If you don't need acadobject, acadprefs, and acadprofilesas as global variables, you can nest the expressions in a single one.

 

The way I'll do it: create an acaddoc.lsp file in a search path and add to it:

(vl-load-com)
((lambda ()
  (vla-put-ActiveProfile
    (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))
    "P20090626A"
  )
  (princ)
)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...