AutoCAD 2010/2011/2012 DWG Format
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I'm not sure this is even possible but I was hoping to create a multifunction LISP. I've created simple LISPs in the past but not having any actual training in the language, I'm not sure how to make a LISP for what I want to do.
What I'm trying to do is create a LISP that will:
Select All (command "_ai_selall")
Properties (command "Properties")
Choose Rotated Dimensions
Change value of Dim Scale Linear
Change Value of Dim Units
Change Value of Precision
Choose Aligned Dimensions
Change value of Dim Scale Linear
Change Value of Dim Units
Change Value of Precision
Choose Radial Dimensions
Change value of Dim Scale Linear
Change Value of Dim Units
Change Value of Precision
Close Properties (command "Propertiesclose")
Deselect All
For all the value changes, I'm only trying to change the value of the selected objects, I'm not trying to change variables for dimsension styles like DIMLUNIT does for example.
I'm using AutoCAD 2012 on Windows 7, any help would be much appreciated.
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I don't have time (any maybe not the knowledge) to write it for you, however, I can point you to some terms and ways of doing things. As far as I know most of the LISP users here are self taught too, so don't be afraid to look in 2012's developer documentation and around the internet too.
First, for selecting the appropriate objects, you need to create a selection set of them (by what you said in your message, you're going to need 3, one for each type of dimension). Just search for "selection set" in the forums if you have problems or questions, there are quite a few that deal with selection sets.
Second, you're going to be prompting the user for input and storing this input in variables (not system variables which you appear to want to override).
There is no need to "select all" of the objects; creating selection sets will eliminate this and the need for the properties palette.
(if ("mysolution"=answer) then (click "Accept As Solution"))
--------------------------------------------------
Brandon Gingerich
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I could be missing the point, but dimensions should be controlled by style, not by override. Create the styles you want to use and then use dimupdate.
Aside: Strongly suggest that you change your workflow so that changing your linear factor is never necessary.
For LISP help post in the customization forum.
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
@bgingerich
I'll take a look at selection sets, thanks for the info. As for prompting users for input, I actually want to include a value in the LISP to autochange the values. Let's say before I run the LISP, Dim Scale Linear = 1. After I run the LISP, I want it to automatically change it's value to .03937.
@dbroad
Our shop draws in metric, we dimension in metric, we cut in metric, we build in metric, we do everything in metric. However, when we print out a set of drawings for the client, we need to change our dimensions to inches. I could go into each DimStyle and change it there and then update the drawing, but when I'm using anywhere from 5-12 DimStyles on a job, it is much easier to change all the dimensions at once by using the properties override. The whole point of the LISP for me was to have an automated command to change all my dimensions from metric to inches & another LISP to change them from inches to metric.
@pendean
Thanks for the link. Should I recreate the thread over in that forum or try to find a mod to move this one? I'm new here so not sure on the protocols as they vary from site to site.
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
PuckTheJoker wrote:@bgingerich
I'll take a look at selection sets, thanks for the info. As for prompting users for input, I actually want to include a value in the LISP to autochange the values. Let's say before I run the LISP, Dim Scale Linear = 1. After I run the LISP, I want it to automatically change it's value to .03937.
@dbroad
Our shop draws in metric, we dimension in metric, we cut in metric, we build in metric, we do everything in metric. However, when we print out a set of drawings for the client, we need to change our dimensions to inches. ...
Did you know that there is an alternate units option in DIMSTYLE? You can have your dimensions in your metric standard (cm, mm, etc.) and the alternate units be in inches. See attached screenshot (inches with mm as alternate unit).
And if you really want to change via LISP, yes, post your question in that forum.
(if ("mysolution"=answer) then (click "Accept As Solution"))
--------------------------------------------------
Brandon Gingerich
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
PuckTheJoker,
maybe something like this:
(defun c:mm2inc (/ ss i ent obj); milimeters to inches
(if (setq ss (ssget "_x" '((0 . "DIMENSION"))))
(progn
(setq i 0)
(while (setq Ent (ssname ss i))
(setq obj (vlax-ename->vla-object ent))
(if (member (vla-get-ObjectName obj)
'("AcDbRotatedDimension"
"AcDbRadialDimension"
"AcDbAlignedDimension"
)
)
(progn
(vla-put-UnitsFormat obj 3); change as you need
(vla-put-LinearScaleFactor obj (/ 1 25.4))
(vla-put-PrimaryUnitsPrecision obj 2) ; change as you need
(setq i (+ 1 i))
) ;progn
(setq i (+ 1 i))
) ; if
) ; while
) ; progn
) ; if
(setq ss nil)
(princ)
) ; defun
(defun c:inc2mm (/ ss i ent obj); inches to milimeters
(if (setq ss (ssget "_x" '((0 . "DIMENSION"))))
(progn
(setq i 0)
(while (setq Ent (ssname ss i))
(setq obj (vlax-ename->vla-object ent))
(if (member (vla-get-ObjectName obj)
'("AcDbRotatedDimension"
"AcDbRadialDimension"
"AcDbAlignedDimension"
)
)
(progn
(vla-put-UnitsFormat obj 2)
(vla-put-LinearScaleFactor obj 1)
(vla-put-PrimaryUnitsPrecision obj 3) ; change as you need
(setq i (+ 1 i))
) ;progn
(setq i (+ 1 i))
) ; if
) ; while
) ; progn
) ; if
(setq ss nil)
(princ)
) ; defun
hope that helps
Henrique
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
After changing a couple of the obj numbers, it worked perfectly. Thank you for all of your help, I really appreciate it.
I also want to thank everyone else who gave me suggestions, I'm glad to see people who actually try to help others, not flame or troll them for their lack of information.
Re: Help creating a LISP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You're welcome, PuckTheJoker
Henrique
