pBe Posted March 4, 2014 Share Posted March 4, 2014 Thanks so nice of you No worries anhan008, as it turned out, the sort thingy is an easy mod so i updated the code above. the table will definitely wait tomorrow. Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 4, 2014 Author Share Posted March 4, 2014 (edited) Thanks for your support and i appropriate you help Edited March 6, 2014 by anjan008 Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 I think your Pack Washers are on a different layer, your also need to change to the proper layer. Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 4, 2014 Author Share Posted March 4, 2014 is it possible to do for both layers which are "7_Graphics" "25_Bolt designation" thanks Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 is it possible to do for both layers which are "7_Graphics" "25_Bolt designation" thanks It seems your Packing Washer text is laid out completely different, I see no * as a separator in it. Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 If the text was laid out the same this would work for both; (defun c:Mk_lst (ltr LName / an txt) (defun addme (an LName txt / trunc data ss i e match) ;;; pBe04Mar2014 ;;; (defun trunc (s m) (atoi (if m (substr s (+ 2 (vl-string-position an s))) (substr s (+ 2 (vl-string-position 42 s nil t))) ) ) ) (if (setq data nil ss (ssget "_X" (list '( 0 . "TEXT") (cons 1 txt) (cons 8 LName) ) ) ) (progn (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (setq data (cons (cdr (assoc 1 (entget e))) data)) ) (setq data (vl-sort data '(lambda (b c) (cond ((< (setq d (trunc b t)) (setq f (trunc c t))) t) ((= d f) (< (trunc b nil) (trunc c nil))) ) ) ) ) (While (setq a (car data)) (setq ref (substr a (1+ (vl-string-position an a)))) (setq match (vl-remove-if-not '(lambda (s) (wcmatch s (strcat "*" ref))) data ) ) (princ (strcat "\n" ref " = " (itoa (apply '+ (mapcar '(lambda (k) (if (zerop (atoi k)) 1 (atoi k) ) ) match ) ) ) ) ) (setq data (vl-remove-if '(lambda (y) (member y match)) data)) ) ) ) (princ) ) (setq an (ascii ltr) txt (strcat "*" ltr "##`**") ) (addme an LName txt) ); (vl-load-com) You would use this to call the function at Autocad command prompt; (Mk_lst "P" "7_Graphics") (Mk_lst "M" "25_Bolt designation") Depending on what outcome you where looking for. Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 4, 2014 Author Share Posted March 4, 2014 Command: mk_lst ; error: too few arguments Could not able to call that command after loading it Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 My bad use this dropped the accidentally c: ; "(c:Mk_lst "P" "7_Graphics")" "(c:Mk_lst "M" "25_Bolt designation")" You need to type everything between the quotes, not just "Mk_lst" Example; Command: (c:Mk_lst "M" "25_Bolt designation") Works fine for the Bolt List, you did not answer the question regarding the Packing Washer Text... Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 Does this 4PW-10mm mean there are 4, PW-10mm washers, if so you need to have text read 4*PW-10mm to utilize the lisp provided by pBe. Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 4, 2014 Author Share Posted March 4, 2014 Yes 4PW-10mm mean there are 4, PW-10mm washers I dont want like Bolts... Only bolts will have * For washers its not working (c:Mk_lst "P" "7_Graphics") Thanks Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 4, 2014 Share Posted March 4, 2014 I know that, due to text format being completely different than bolts. If you noticed this forum is called "CADTutor", now that you have the code for the bolts list, maybe you could give the washers a try on your own. Quote Link to comment Share on other sites More sharing options...
pBe Posted March 5, 2014 Share Posted March 5, 2014 (edited) Thanks for your support. Same way i want to calculate PW (Pack washer)quantity also I'll have a look see in a bit. If the text was laid out the same this would work for both; (defun c:Mk_lst (ltr LName / an txt)... You would use this to call the function at Autocad command prompt; (Mk_lst "P" "7_Graphics") (Mk_lst "M" "25_Bolt designation") Depending on what outcome you where looking for. Looks interesting Snownut, I think i can find a way to incorporate both options on the _trunc sub-function. Thank you for your assistance kind sir. CODE UPDATED at post #14 @anjan008, Kindly remove the code you posted at post number 22 Edited March 5, 2014 by pBe Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 5, 2014 Share Posted March 5, 2014 Nice work pBe... Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 6, 2014 Author Share Posted March 6, 2014 Thanks for your help, Which variable i have to change if the bolts and washer are indicated like below 5-A 8-B 1-C 2W-6 5W-8 3W-10 4W-12 Thanks and regards Quote Link to comment Share on other sites More sharing options...
Snownut Posted March 6, 2014 Share Posted March 6, 2014 You may want to contact pBe, to see how much he is going to charge you to keep customizing your custom built application, since you seem to be unable to post just what it is you are looking for. How much time is application saving you & your company? Quote Link to comment Share on other sites More sharing options...
anjan008 Posted March 7, 2014 Author Share Posted March 7, 2014 Thanks for help for above program. Sorry for asking, i will try to do by learning slowly. Quote Link to comment Share on other sites More sharing options...
anjan008 Posted August 2, 2014 Author Share Posted August 2, 2014 Dear Pbe Can you please help me to suite addme lisp to calculate bolts and washers as below 5-A 8-B 1-C 2PW-6 5PW-8 3PW-10 4PW-12 Thanks for previous lisp Quote Link to comment Share on other sites More sharing options...
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.