git_thailand Posted February 29, 2012 Posted February 29, 2012 need code 1. auto column on grid line intersection (in layer column) pic. 1 need code 2. select grid for auto dimension (in layer dimension) pic. 2 thank you. Quote
ReMark Posted February 29, 2012 Posted February 29, 2012 (edited) Let me take a wild guess here. You would like someone to tell you how to go about either 1) finding a lisp routine that will do this or 2) how to write a lisp routine that will do this. Which is it? It always helps to be as specific as one can be to avoid any confusion on what is being asked. Edited February 29, 2012 by ReMark Quote
MSasu Posted February 29, 2012 Posted February 29, 2012 You may try the QDIM build-in command. Regards, Mircea Quote
git_thailand Posted February 29, 2012 Author Posted February 29, 2012 i need how to write a lisp Quote
Lee Mac Posted February 29, 2012 Posted February 29, 2012 Here are two functions to get you started: [color=GREEN];;----------------=={ Intersections in Set }==----------------;;[/color] [color=GREEN];; ;;[/color] [color=GREEN];; Returns a list of all points of intersection between ;;[/color] [color=GREEN];; objects in a selection set ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Arguments: ;;[/color] [color=GREEN];; ss - SelectionSet ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Returns: List of intersection points, or nil ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] ([color=BLUE]defun[/color] LM:IntersectionsInSet ( ss [color=BLUE]/[/color] i1 i2 ls o1 o2 ) ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i1 ([color=BLUE]sslength[/color] ss)) ([color=BLUE]setq[/color] o1 ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] ss ([color=BLUE]setq[/color] i1 ([color=BLUE]1-[/color] i1))))) ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i2 i1) ([color=BLUE]setq[/color] o2 ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] ss ([color=BLUE]setq[/color] i2 ([color=BLUE]1-[/color] i2)))) ls ([color=BLUE]append[/color] ls (LM:GroupByNum ([color=BLUE]vlax-invoke[/color] o1 'intersectwith o2 [color=BLUE]acextendnone[/color]) 3)) ) ) ) ls ) [color=GREEN];;-----------------=={ Group by Number }==--------------------;;[/color] [color=GREEN];; ;;[/color] [color=GREEN];; Groups a list into a list of lists, each of length 'n' ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Arguments: ;;[/color] [color=GREEN];; l - List to process ;;[/color] [color=GREEN];; n - Number of elements by which to group the list ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Returns: List of lists, each of length 'n' ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] ([color=BLUE]defun[/color] LM:GroupByNum ( l n [color=BLUE]/[/color] r) ([color=BLUE]if[/color] l ([color=BLUE]cons[/color] ([color=BLUE]reverse[/color] ([color=BLUE]repeat[/color] n ([color=BLUE]setq[/color] r ([color=BLUE]cons[/color] ([color=BLUE]car[/color] l) r) l ([color=BLUE]cdr[/color] l)) r)) (LM:GroupByNum l n) ) ) ) Carefully read the descriptions in the headers, including the arguments / returns. With these, most of the hard work is already done, what remains for you to do: Prompt the user for a Selection Set of Grid-lines Pass the set to the appropriate function above Iterate over the list of points returned, and insert a block at each point in the list. Quote
git_thailand Posted February 29, 2012 Author Posted February 29, 2012 lee mac. i nedd example this fuctions Quote
MSasu Posted February 29, 2012 Posted February 29, 2012 Since Lee Mac is no longer on-line, please find below an example of usage of his intersections finder: (vl-load-com) [color=blue] ;add Lee Mac's code here[/color] (setq SelectionSet (ssget '((0 . "LINE")))) (LM:IntersectionsInSet SelectionSet) Regards, Mircea Quote
git_thailand Posted March 1, 2012 Author Posted March 1, 2012 You may try the QDIM build-in command. Regards, Mircea Thank you. and how to auto column ??? Quote
Tiger Posted March 1, 2012 Posted March 1, 2012 Thank you.and how to auto column ??? how about just a simple ARRAY? Quote
MSasu Posted March 1, 2012 Posted March 1, 2012 and how to auto column ??? This may get you started: (vl-load-com) [color=blue];add Lee Mac's code here[/color] (setq SelectionSet (ssget '((0 . "LINE")))) (setq PointsList (LM:IntersectionsInSet SelectionSet)) (setq OldOsmode (getvar "OSMODE")) ;retain user setup (setvar "OSMODE" 0) ;disable OSMODE (foreach thePoint PointsList ;add circles in each intersection (command "_CIRCLE" thePoint 1.0)) (setvar "OSMODE" OldOsmode) ;restore user setup Regards, Mircea Quote
Lee Mac Posted March 1, 2012 Posted March 1, 2012 and how to auto column ??? Did you read & understand what my functions are doing? Think about how you would insert the Columns manually, and consider the functions 'foreach' and 'command' 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.