Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import page setup from different directory structures

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
hungqdo
388 Views, 4 Replies

Import page setup from different directory structures

Hi all,

 

I have a lisp to import page setup form specific template like this: 

 

(setq expert (getvar "EXPERT"))(setvar "EXPERT" 2) (setvar "dimasz" 0.1)

(command "_.-PSETUPIN" "C:/Users/Asus/Dropbox/Soft Refs/Civil 3D/1c3d.dwt" "*")
(setvar "expert" expert))

 

The problem is we are using dropbox so the first part "X:/Users/Asus/..." different from each user. How should I modify the Lisp to find 1c3d.dwt automatically from different setup.

 

Thanks in advanced for your help.

 

Mike 

4 REPLIES 4
Message 2 of 5
Ajilal.Vijayan
in reply to: hungqdo

use the LOGINNAME variable to find the user name and build the file path from that value

 

(setq usr (getvar "loginname"))
(setq fname (strcat "C:/Users/" usr "/Dropbox/Soft Refs/Civil 3D/1c3d.dwt"))

(command "_.-PSETUPIN" fname "*")

 

Message 3 of 5
hungqdo
in reply to: hungqdo

It works like a charm. 

 

Thanks again

 

Message 4 of 5
Ajilal.Vijayan
in reply to: hungqdo


@hungqdo wrote:

It works like a charm. 

 

Thanks again

 


Welcome to Autodesk Forum !!

Glad I could help..

Message 5 of 5
BlackBox_
in reply to: hungqdo

FWIW - 

 

If you'd like to then set your newly imported Page Setup as 'current' for each Layout, this plug-in may be of use:

 

(foreach layoutname (layoutlist)
  (vla-SetActivePageSetup layoutname “YourPageSetupName”)
)

 

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost