Nobull84 Posted November 26, 2013 Posted November 26, 2013 I have a lisp, from Kent Cooper circa 2010, that enters a dimension at each line that intersects. It seems to be limited as to what kind of objects it breaks at. The CAD at my company has custom objects they have incorporated and the lisp does not recognize them as objects. Anyone able to change this around a little to dimension ALL objects? Thank you. ;; QuickDimAligned.lsp [command name: QDA] ;; To make a collinear series of Aligned Dimensions along ;; a single fence line, between all intersections of that line ;; with intersectable objects. ;; Kent Cooper, July 2010 ;;;; [optional features could be added: account for other ;;;; Coordinate Systems; set layer and/or dimension style] (defun C:QDA (/ *error* orth osm blipm dse1 dse2 pt1 pt2 ss obj intp intc inclist intpt distpt distpts intclist intplist) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort")) (princ (strcat "\nError: " errmsg)) ); end if (command) (setvar 'osmode osm) (setvar 'orthomode orth) (setvar 'blipmode blipm) (setvar 'dimse1 dse1) (setvar 'dimse2 dse2) (command "_.undo" "_end") (setvar 'cmdecho cmde) ); end defun - *error* (vl-load-com) (setq cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.undo" "_begin") (setq orth (getvar 'orthomode) osm (getvar 'osmode) blipm (getvar 'blipmode) dse1 (getvar 'dimse1) dse2 (getvar 'dimse2) ); end setq (setvar 'orthomode 0) (setq pt1 (getpoint "\nStarting Point of QuickDim virtual line: ") pt2 (getpoint pt1 "\nOther End: ") ss (ssget "F" (list pt1 pt2) '((0 . "*LINE,ARC,CIRCLE,ELLIPSE,RAY,SOLID,3DFACE,REGION"))) ); end setq (setvar 'osmode 0) (setvar 'blipmode 0) (setvar 'dimse1 1) (setvar 'dimse2 1) (command "_.line" pt1 pt2 "") (setq templine (entlast)) (repeat (sslength ss); for each object in selection (setq obj (vlax-ename->vla-object (ssname ss 0)) intline (vlax-ename->vla-object templine) intp (vla-intersectwith obj intline acExtendNone); INTersection Point(s) intc (safearray-value (variant-value intp)); INTersection Coord's [all together] intclist (append intclist intc); cumulative list for all objects so far ); end setq (ssdel (ssname ss 0) ss); remove object ); end repeat (entdel templine) (repeat (/ (length intclist) 3); number of [apparent] intersections (setq intpt (list (car intclist) (cadr intclist) (caddr intclist)); first remaining point distpt (cons (distance pt1 intpt) intpt); list: distance followed by point coordinates distpts (cons distpt distpts); list of those lists intclist (cdddr intclist); remove first point's coordinates for next one ); end setq ); end repeat (setq intplist ; list of intersections in order of distance from pt1 (mapcar 'cdr ; strip distances off sorted list (vl-sort distpts '(lambda (p1 p2) (< (car p1) (car p2))); sorted by distance [first element] ); end sort ); end mapcar ); end setq (command "_.dimaligned" (car intplist) (cadr intplist) (cadr intplist)) (setq intplist (cddr intplist)); remove first two points [already used] (while intplist ; as long as there's still another point (command "_.dimcontinue" (car intplist) "" "") (setq intplist (cdr intplist)) ); end while (setvar 'osmode osm) (setvar "orthomode" orth) (setvar 'blipmode blipm) (setvar 'dimse1 dse1) (setvar 'dimse2 dse2) (command "_.undo" "_end") (setvar 'cmdecho cmde) (princ) ); end defun - QDA (prompt "\nType QDA for QuickDimAligned collinear intersection dimensions.") (princ) Quote
Nobull84 Posted November 26, 2013 Author Posted November 26, 2013 And is it also possible to add something so that there are leader lines? This part is not so important but it would save clean up time. As it sits, I perform the command and then have to add lines to extend to the object they are dimensioning. I am aware there are several ways of doing this but I'm always hunting the fastest way of doing things (call it the typical lazy American attitude I suppose)... It always seems someone wants to point out the obvious commands that would technically do the job but still take too long. Thanks again for the help. This forum always has some very helpful and smart individuals doing something I can't. Quote
lamensterms Posted November 27, 2013 Posted November 27, 2013 Hi NoBull, What sort of custom objects would you like to operate on? Currently the routine seems to work on LINE,ARC,CIRCLE,ELLIPSE,RAY,SOLID,3DFACE,REGION. Though I have not tested it. Just for your info as well... seeing as this routine is not your own - other folk on the forum may be hesitant to modify it (without permission from the author). I am not certain of this, it may be no issue - just something that occurred to me. Quote
Nobull84 Posted November 27, 2013 Author Posted November 27, 2013 I guess that's part of my problem. I'm not sure what exactly what the object is. Using quick properties, there is no designation as "line" or "circle". It resembles a polyline I suppose. It almost seems like a custom object, if that makes any sense at all. Half of the commands I use are not standard cad. Beam and accessory commands, etc... That's also my ignorance with lisp talking here too. I did see the the major types of objects in the code but I didn't know if there was an "all object" code. As far as rewriting etiquette, and being new to the lisp world, my impression was as long as credit was given was a major part But if that's the way it is, I would understand. Quote
lamensterms Posted November 27, 2013 Posted November 27, 2013 It is possinle to allow the routine to 'see' all objects (rather than filtering some out). But I cannot be sure if the objects you have will be accepted to have dimensions created from them. Out of curiosity… what do you see when you LIST your custom objects? Maybe paste the text which appears in the text window here. Quote
Nobull84 Posted November 27, 2013 Author Posted November 27, 2013 Instead of the standard title of line or arc or something, it's titled as structuralsupport or something along those lines. I'll post a picture Monday when I'm at the office next. Off for the holidays. Appreciate your help though. Quote
Recommended Posts
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.