AutoCAD Visual LISP / AutoLISP :: Set Model Space To Display As Plot Style?
Jun 28, 2012
Is there a way to get model space to "display plot styles" through a lisp routine or a script?
i'm currently setting up a whole bunch of custom tool palettes for the company I work for and instead of the icons displaying in their actual colour (at the moment they're green, which doesn't show up very well on the light grey background), I'd rather they show in the plotstyle assigned to the individual dwg's.
call up the page setup manager (while in model space) and click modify, you can then check the radio button to "display plot styles" in the top-right corner. But when you have around 100 - 200 blocks to change, that process can be rather time consuming and cumbersome!
I've tried doing a block that automatically updates the X and Y coordinates from its moveable leader. I can get it to work in model space or paper space. But my problem is I want it to work in PS, but update with the MS coordinates through the viewport.
I can get it to update, by LISP, by picking a point and passing the points to the blocks attributes. At the moment I have a LISP when actioned it locks the viewports, activates the viewport, and asks you to select a point. Once selected it de-activates the viewport (going back into layout tab) then asks which block you want to update. Where you now select the block and it updates the coordinates. I.e. manually pick the point in MS, switch to PS and then manually pick the block. Then I have to manually modify the leader to the correct location.
I'm hoping that I can (In PS) move the end of the leader to snap to a position in MS and the coord updates to reflect the correct MS coordinates. I'm thinking that maybe this can't be done automatically and that I maybe can move the leader but I'm not sure how I can do it without running a LISP to update the block?
I'd be happy moving the leader then just running a single command and the leader coordinates updating without having to select the points and the block again.
I've attached the block showing the auto update of the attributes (fields).
Is it possible to create a lisp that would change the plot style table? I don't know of any variable to type to change that. We convert drawings from Solid works to AutoCad and use the basic monochrome plot style. I'd like to easily change that since the act of doing that is repeated many times.
I have code that will set and sae a current UCS to the front of an entity, of course, depending on the viewpoint. This is so, because we need all draft lines in front of 3D solids, such as dimensions, leaders for labels, text entities and so on (the reason for not putting these entities in paper space is another discussion ).
But I'll have on of two problems on numerous occasions:
1. The user forgets all together to run the command. 2. The user will pick the wrong entity that is in the foremost position in that view.
Where else do they keep this setting? I only have found it in Active Layout in extended dada
(entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*")) The last pice of extended data is: ("PLOTTRANSPARENCY" (1071 . 0)) When i change it to 1 (setq layout(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) (vla-getXdata layout "PLOTTRANSPARENCY" 'type 'data) (vlax-safearray-fill data '("PLOTTRANSPARENCY" 1)) (vla-setXdata layout type data)
it stays there (extended data), but the setting in Plot dialog box doesn't change!!! And it still prints no transparency.
It takes to save the drawing and reopen it again to see the change.
The command -PLOT does not have this setting as well, so my options back to VBA or Lisp, but HOW?
I am aware of the plot stamp available in the Plot Dialog box, however, we are looking at ways to imbed this info in the dwg. I currently have the WD_TB with an attribute for FULLFILENAME, an attribute for PLOT DATE, and an attribute for PLOT TIME12. So I get the information on the dwg. I would like to be able to run all these attributes as a string. I have tried FULLFILENAME|PLOT DATE|PLOT TIME12 with spaces, commas, ( ), " ", etc. and I do not know the proper syntax to get this to work. I have also tried (getenv "FULLFILENAME") or the getvar, in the title descriptions box.
I am looking for a way to change the text style used by a table style with Visual LISP. So far I have been able to get the IAcadTableStyle object from the acad_tablestyle dictionary, but there is no property for text style. Is this even possible? Code and results are below.
Is there a way to programatically set a visual style before a drawing actually opens?
We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings. Some models will crash on some workstations when trying to open in a rendered mode.
I found a lisp with a function that looked to set viewport visual styles. But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)
Is it possible to open a dwg, change something and then plot a layout with visual lisp. This is my start. Opening is working, but plotting not. I have to switch between drawings before the function is going on. Sometimes it's plotting an empty sheet and otherwise an error: ERROR: Automation Error. Description was not provided.
I have this lisp which will display the height of a 3D object to 2 dps. What I need is for 3dps to be displayed but I have no real understanding of LISP coidng so I can't work out where this is specified in the routine.
Why this LISP does not work when I try to use it in a drawing which has a Pointools POD file working (or previously had one) within it?
Goal: using the native windows explorer, Open the folder containing the the multitude of drawings from different vendors and customers, usually 30 -40 .dwg files.
Highlight all the files, Right click print.behind the scenes without any further clicking or involvement from the user autocad plots the extents of model space of all the drawings to a designated plotter fit to 11x17 sheets.
I wrote (setq oldtext (getvar "textstyle")) to save the current text style,
(setvar "textstyle" (getvar "dimtxsty")) to change the text style to the current dimension text style (which appens to be romans) and later (setvar "textstyle" oldtext) to restore the text style to its original setting but it won't work.
This is the same format used to save and restore osnap in many lisp routines.
When I check the program in the visual lisp editor, oldtext returns "standard" (the original text style - so that part works) but "textstyle" returns nil. I even tried (setvar "textstyle" "standard") to no avail. "Textstyle" remains romans.