Visual LISP, AutoLISP and General Customization

Reply
Contributor
mr-_-small
Posts: 17
Registered: ‎12-03-2012
Message 1 of 5 (273 Views)
Accepted Solution

creat a command

273 Views, 4 Replies
12-04-2012 06:34 PM

i made a toolbar that has a command like this "_plot 752.3389,680.5393 641.0157,524.6924" a print command.

when i click on the toolbar commands the print windows appear then i click on the option "windows", autcad take the coordinates and print the object , 

 

http://www.youtube.com/watch?v=HzYJVMeHOag&feature=youtu.be

it works..

 

but i have to click on the button "window" when print window appear ..

is there any way to make the command choose a particular button of the print window..

 

thax 

 

 

Valued Contributor
Rtogores
Posts: 84
Registered: ‎02-07-2001
Message 2 of 5 (253 Views)

Re: creat a command

12-04-2012 11:56 PM in reply to: mr-_-small

I believe you should use something more powerful than a menu macro. You can use Visual LISP to set the Layout's PlotType property before you try to plot.

Look for PlotStyle in the ActiveX Reference.

This is a sample program included in the AutoCAD 2013 ActiveX Reference:

(vl-load-com)
(defun c:Example_PlotType()
    ;; This example reads and modifies the PlotType
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))
    
    ;; Read and display the original value
    (setq originalValue (vla-get-PlotType ACADLayout))
    (alert (strcat "The PlotType value is set to: " (itoa originalValue)))

    ;; Modify the PlotType preference by toggling the value
    (vla-put-PlotType ACADLayout acExtents)
    (alert (strcat "The PlotType preference has been set to: " (itoa (vla-get-PlotType ACADLayout))))

    ;; Reset the preference back to its original value
    (vla-put-PlotType ACADLayout originalValue)
    (alert (strcat "The PlotType preference was reset back to: " (itoa originalValue)))
)

 I hope this helps.

 

*Expert Elite*
hmsilva
Posts: 2,668
Registered: ‎12-17-2004
Message 3 of 5 (239 Views)

Re: creat a command

12-05-2012 02:00 AM in reply to: mr-_-small

mr-_-small,

put this macro in your button...

 

^C^C-PLOT;Y;;;;;;;W;752.3389,680.5393;641.0157,524.6924;;;;;;;;;;

 

the best way is to write macros is using the command-line version.
of the command you want to use, and see how many enters are needed and the required options...

 

Hope that helps,

 

Henrique

Contributor
mr-_-small
Posts: 17
Registered: ‎12-03-2012
Message 4 of 5 (213 Views)

Re: creat a command

12-05-2012 10:48 AM in reply to: hmsilva

thank you  fhmsilva .... thiss exactly what im looking for....

 

 

you are awesome and brilliant ..... best answer 

*Expert Elite*
hmsilva
Posts: 2,668
Registered: ‎12-17-2004
Message 5 of 5 (198 Views)

Re: creat a command

12-05-2012 01:50 PM in reply to: mr-_-small

You're welcome, mr-_-small

 

Henrique

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community