wizman Posted February 18, 2010 Posted February 18, 2010 Hi c2designkitchen, i dont have the message in my inbox anymore. I just made a quick edit to separate the polyline combine. Here is Combine.lsp, (defun c:combine (/ flag fuzz plist pt ss sset) (vl-load-com) (defun *error* (msg) (and doc (vla-EndUndoMark doc)) (acet-ui-progress) (setvar 'cmdecho 1) ) (setq doc (vla-get-activedocument (vlax-get-acad-object) ) ) (vla-EndUndoMark doc) (vla-StartUndoMark doc) (setvar 'cmdecho 0) (if (and (princ "Select Lines to combine") (setq ss (ssget '((0 . "LINE")))) ) (progn (setq sset (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (acet-ui-progress "PROCESSING..." (length sset)) (foreach x sset (setq lst nil) (if (not (vlax-erased-p x)) (foreach p (setq plist (list (vlax-curve-getstartpoint x) (vlax-curve-getendpoint x) ) ) (foreach y sset (and (not (equal x y)) (equal (vlax-curve-getclosestpointto y p) p 1e-8 ) (not (vlax-erased-p x)) (entmake (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 3) (cons 70 0) ) (vl-remove nil (mapcar (function (lambda (p) (if (not (vl-position p lst)) (progn (setq lst (cons p lst)) (cons 10 p) ) ) ) ) (vl-sort (list (vlax-curve-getstartpoint x) (vlax-curve-getendpoint x) (vlax-curve-getstartpoint y) (vlax-curve-getendpoint y) ) (function (lambda (e1 e2) (< (cadr e1) (cadr e2)) ) ) ) ) ) ) ) (not (vla-delete (vlax-ename->vla-object x))) (not (vla-delete (vlax-ename->vla-object y))) (setq sset (vl-remove x sset) sset (vl-remove y sset) plist (vl-remove p plist) ) ) ) ) ) (acet-ui-progress -1) ) (error "") ) ) (princ) ) Quote
c2designkitchen Posted February 18, 2010 Author Posted February 18, 2010 So, will this make polylines only out of segments that are perfectly aligned by endpoints? BTW, is the message still in your trash box? Quote
wizman Posted February 19, 2010 Posted February 19, 2010 So, will this make polylines only out of segments that are perfectly aligned by endpoints? Yes but limited only to two lines. You can try also built-in command MPEDIT to turn them into polylines and join them with fuzz=0. BTW, is the message still in your trash box? Sorry, it's not there also, Quote
SEANT Posted February 19, 2010 Posted February 19, 2010 Nice little macro Sean. Mind if I borrow it? Please do. Quote
c2designkitchen Posted February 20, 2010 Author Posted February 20, 2010 Thanks! I will try MPEDIT, Wizman. But, before I can do that, I have one other task to complete... Quote
c2designkitchen Posted February 20, 2010 Author Posted February 20, 2010 Okay, here is my new question. It's a pretty tough one! Can you guys take a look at it and see if it's workable? http://www.cadtutor.net/forum/showthread.php?t=45048 TyTyTy! Quote
JRJ Posted February 27, 2010 Posted February 27, 2010 Hi Seant, can you please list down the steps to make the new refpolarray command in CUI, including how you got the new icon & ID? I tried adding it with the "create a new command button" but still doesn't seem to work. Thanks a lot. Quote
c2designkitchen Posted February 27, 2010 Author Posted February 27, 2010 You have to create a new toolbar for the new button. Quote
SEANT Posted February 28, 2010 Posted February 28, 2010 As already stated, creating a new toolbar would be a good choice. But, after the new command is created, you need to drag that command onto the new toolbar (or existing if that is a preference). The command ID was generated automatically. You may be able to give it a specific ID, I’m not sure why that would be necessary. Sticking with the auto generated ID should prevent any conflicts. With regard to the icon; AutoCAD’s icon editor is pretty crude. It is possible to create your own icon in another bitmap editing app. This usually allows re-sampling to the appropriate size (16 x 16, 32 x 32) while allowing for anti-aliasing. Quote
SEANT Posted February 28, 2010 Posted February 28, 2010 c2designkitchen, were you able to finalize your project? Quote
smarcus3 Posted July 22, 2010 Posted July 22, 2010 ^C^C_Select;\-array;p;;P;b;\\\'Cal;ang(cur,cur,cur);[/Code] this new edit to the command allow the user to choose the base point. this makes it work much better for array multiple objects around a point. Thoughts? Quote
Cam83 Posted February 22, 2011 Posted February 22, 2011 Greetings. Sorry to post to a "dead" thread, but I had one question: ^C^C_Select;\-array;p;;P;b;\\\'Cal;ang(cur,cur,cur); In order for a custom command with this code to work, does it require any sort of LISP Macro/Code to work, or does it just work without needing any further setup or coding. Thanks! Quote
designerstuart Posted February 22, 2011 Posted February 22, 2011 it is a macro - you can make a button and this code is the function it performs (no lisp necessary!) Quote
Cam83 Posted February 23, 2011 Posted February 23, 2011 A question, I am trying to set someone up with a command for the original macro: ^C^C_Select;\-array;p;;P;\\'Cal;ang(@,cur,cur); The user has Autocad LT 2009. The macro runs, and I do the exact procedure which the animated GIF attached suggests you should do. However, when I select the second point, I get an error: Requires valid numeric angle or second point. The following is the output on the command line when running the command: Select objects: 1 found Select objects: Enter the type of array [Rectangular/Polar] <R>: P Specify center point of array or [base]: Enter the number of items in the array: 5 Specify the angle to fill (+=ccw, -=cw) <360>: 'Cal >>>> Expression: ang(@,cur,cur) >>>> Enter a point: >>>> Enter a point: Resuming -ARRAY command. Specify the angle to fill (+=ccw, -=cw) <360>: 5'-1-5/8" Requires valid numeric angle or second point. Specify the angle to fill (+=ccw, -=cw) <360>: *Cancel* Any help would be appreciated. Thanks. Quote
SEANT Posted February 24, 2011 Posted February 24, 2011 Somehow the Cal command is misinterpreting the pick points. This line here shows that the Cal returning a linear measure: Specify the angle to fill (+=ccw, -=cw) : 5'-1-5/8" I originally suspected that some unit other than degrees was set, DegreesMinutesSeconds in particular. Though, here, that doesn’t seem to have any ill effect. Interestingly enough, I found that the macro will produce erroneous result with Radians and Gradians set for angular units. The macro does run to completion, it is just that the angles are wrong. Perhaps it is a localization issue: Is the AutoCAD install set up to use a comma for the decimal point? Quote
Cam83 Posted February 24, 2011 Posted February 24, 2011 SEANT, Thanks for your reply. The user has their Angular Units set to Decimal Degrees, and they are not using a comma for the decimal point, or any other customized localization settings as far as we know. Also, just to clarify further, When we get to the step where you enter the second point: we click the second point, we get the error stated above, and then autocad begins giving us a line from the center point of the array we specified (as if it is trying to measure or draw a line from the center point. We then click on final point, rotate objects, and the macro finishes, with the angle of arrayed objects incorrect. Quote
SEANT Posted February 25, 2011 Posted February 25, 2011 I can’t reproduce the error. Given that macros just script prompts and user input, what happens if the sequence of input is entered manually? The Command Line sequence for that process would look like this: Command: -array Select objects: 1 found Select objects: Enter the type of array [Rectangular/Polar] <R>: p Specify center point of array or [base]: Enter the number of items in the array: 6 Specify the angle to fill (+=ccw, -=cw) <360>: 'cal >>>> Expression: ang(cur,cur,cur) >>>> Enter a point: @ >>>> Enter a point: >>>> Enter a point: Resuming -ARRAY command. Specify the angle to fill (+=ccw, -=cw) <360>: 39.121046543005 Rotate arrayed objects? [Yes/No] <Y>: y Quote
Cam83 Posted March 16, 2011 Posted March 16, 2011 I am very happy to see the boards back online. Ironically, when doing the command line procedure that SEANT outlined above, the procedure works perfectly. I have my colleague using this macro: ^C^C_Select;\-array;p;;P;\\'Cal;ang(cur,cur,cur); which works, you just have to manually enter @ when asked for this first point. My colleague is very happy with it, as it is far better than what he used to have to do to get the polar arrays to work. Apparently the macro we were trying would not give us the at sign (@) for the first point, even though it is supposed to automatically. Thank you all for your help! Quote
Sunny S Posted September 25 Posted September 25 On 14/02/2010 at 19:53, SEANT said: While it would be possible to automate this with Lisp or any of the other programming languages, the process was basic enough to just set up a command macro in a toolbar button. This is set up with the CUI command. See attached. Can you please put an animation or small video of how to put a code? 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.