pmxcad Posted January 26, 2018 Author Share Posted January 26, 2018 Rix, It could also be other blocks, not only the U00052. I just to want to now if there is a block connected to a output from the ETV or EIDS. If Yes, insert the Relais block on top of that block/output (see output 01 of the EIDS). PmxCAD Quote Link to comment Share on other sites More sharing options...
rlx Posted January 26, 2018 Share Posted January 26, 2018 Rix,It could also be other blocks, not only the U00052. I just to want to now if there is a block connected to a output from the ETV or EIDS. If Yes, insert the Relais block on top of that block/output (see output 01 of the EIDS). PmxCAD ok , will do... btw its RLX , not RiX Quote Link to comment Share on other sites More sharing options...
rlx Posted January 27, 2018 Share Posted January 27, 2018 (edited) try this : ; written for PmxCad by RLX on 27 jan 2018 (defun c:CSI ( / #Victim-list #Suspect-list suspect #Crimescene-list #MeToo-list ) (OpenInvestigation) (InvestigateCrimeSceneLocations) (Process_Suspects) (StartMediaCircus) (princ) ) (defun OpenInvestigation () (vl-load-com) (setq #Victim-list (GetFingerpints "AP7803_EIDS,AP7803_ETV") #Suspect-list (GetFingerpints "U000*"))) (defun InvestigateCrimeSceneLocations () (mapcar '(lambda (y) (mapcar '(lambda (x) (if (wcmatch (strcase (vla-get-tagstring x)) "OC_OUTPUT_##_ID") (setq #Crimescene-list (cons (Array->Lst (ExamineSubject x)) #Crimescene-list)))) (vlax-invoke y 'getattributes) ) ) #Victim-list ) ) (defun Process_Suspects ()(foreach suspect #Suspect-list (Interrogate suspect))) (defun GetFingerpints ( filter / result) (if (setq result (ssget "X" (list (cons 0 "INSERT") (cons 2 filter))))(mapcar 'vlax-ename->vla-object (SS->Lst result)))) (defun Interrogate ( x / ip #Me) (setq ip (CheckSuspectsAlibi x)) (if (setq #Me (vl-some '(lambda (y)(if (and (equal (car y) (car ip) 1) (equal (cadr y) (cadr ip) 1)) ip nil)) #Crimescene-list)) (setq #Metoo-list (cons #Me #Metoo-list)))) (defun StartMediaCircus ( / actDoc space relais-symbol-name) (setq relais-symbol-name "Reais") ; you probably mean "Relais" (cond ((not (tblsearch "block" relais-symbol-name))(alert "No relais symbol found in drawing")) ((not (vl-consp #Metoo-list))(alert "Nothing to look at folks")) (t (setq actDoc (vla-get-activedocument (vlax-get-acad-object)) space (if (= (getvar "CVPORT") 1) (vla-get-paperspace actDoc)(vla-get-modelspace actDoc))) (foreach suspect #Metoo-list (vla-insertblock space (lst->Array suspect) relais-symbol-name 1 1 1 0)) (vlax-release-object space)(vlax-release-object actDoc)(princ "\nCase solved!\n")) ) ) (defun ExamineSubject ( e ) (if (and (vlax-property-available-p e 'alignment) (/= (vla-get-alignment e) 0)) (vla-get-TextAlignmentPoint e) (vla-get-InsertionPoint e))) ; thanx Grrr : (vlax-safearray->list (vlax-variant-value (vlax-get-property e 'InsertionPoint))) = (vlax-get e 'InsertionPoint) (defun CheckSuspectsAlibi (e) (if (vlax-property-available-p e 'InsertionPoint t) (vlax-get e 'InsertionPoint))) (defun lst->Array ( l / s a) (setq s (vlax-make-safearray vlax-vbdouble (cons 0 (- (length l) 1))) a (vlax-safearray-fill s l))(vlax-make-variant a)) (defun Array->Lst (a) (vlax-safearray->list (vlax-variant-value a))) (defun SS->Lst (ss) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) ; (c:CSI) gr. Rlx also added 'normal version' as attachement PmxCad_Relais.lsp Edited January 29, 2018 by rlx Quote Link to comment Share on other sites More sharing options...
Grrr Posted January 27, 2018 Share Posted January 27, 2018 Rlx, thats a very thematic function/variable naming! (CSI) Just a 2c to skip the (vlax-safearray->list (vlax-variant-value ..)) conversion [incase you didn't knew] : _$ (vlax-get-property obj 'InsertionPoint) #<variant 8197 ...> _$ (vlax-get obj 'InsertionPoint) (-4794.63 -4312.57 0.0) Quote Link to comment Share on other sites More sharing options...
rlx Posted January 27, 2018 Share Posted January 27, 2018 Rlx, thats a very thematic function/variable naming! (CSI) Just a 2c to skip the (vlax-safearray->list (vlax-variant-value ..)) conversion [incase you didn't knew] : _$ (vlax-get-property obj 'InsertionPoint) #<variant 8197 ...> _$ (vlax-get obj 'InsertionPoint) (-4794.63 -4312.57 0.0) Hi Grrr , I'm sure I can compact the code much more but in this case I just wanted it to read like a (crime) story just for the fun of it. I started out with witch-burning but decided that might p... some people off haha thanx for the advise though, I may have an occasional original idea , your coding skills are outgrowing me fast. gr. Rlx Quote Link to comment Share on other sites More sharing options...
Grrr Posted January 27, 2018 Share Posted January 27, 2018 I just wanted it to read like a (crime) story just for the fun of it. Yeah, I had fun reading it! thanx for the advise though, I may have an occasional original idea , your coding skills are outgrowing me fast. Nah, I'm just good in some aspects of lisp (that automate my work) - not all of them. Shared it, incase you didn't knew (as it would be really a pain to not use it in your 500+ rows programs). Quote Link to comment Share on other sites More sharing options...
rlx Posted January 27, 2018 Share Posted January 27, 2018 (edited) Yeah, I had fun reading it! Glad you liked it have also written a routine which has the theme from the matrix movies but fun as it was , it can be confusing at times. But for such a small routine as this I thought , awel , what the heck... My intension is just to show that programs that are readable are usually easy to maintain you know. Nah, I'm just good in some aspects of lisp (that automate my work) - not all of them. Shared it, incase you didn't knew (as it would be really a pain to not use it in your 500+ rows programs). wow so much already haha. Have enough other programs which are very good but difficult to operate and to maintain so not really good enough to publish (yet) Have a good weekend my friend! gr. Rlx Edited January 28, 2018 by rlx Quote Link to comment Share on other sites More sharing options...
Grrr Posted January 27, 2018 Share Posted January 27, 2018 Have enough other programs which a very good but difficult to operate and to maintain so not really good enough to publish (yet) And I'm burried with so much codes (ideas), that I'm trying to put&organize in my archive, but without being able to figure out an appropriate name for the .lsp file and everyday theres something new on the web, that I decide to collect - just look at my NP++ unsaved storage... Have a good weekend my friend! gr. Rlx Have a great one too, Rlx! Quote Link to comment Share on other sites More sharing options...
pmxcad Posted February 2, 2018 Author Share Posted February 2, 2018 Hi RLX, Thanks for the great lisp. works very wel. Sorry to respond now, did not have a notification mail from cadtutor that there was a new post. PmxCAD Quote Link to comment Share on other sites More sharing options...
rlx Posted February 2, 2018 Share Posted February 2, 2018 Hi RLX,Thanks for the great lisp. works very wel. Sorry to respond now, did not have a notification mail from cadtutor that there was a new post. PmxCAD Must say that #MeToo didn't get an email that there's been a reply , just logged on and saw that you replied. Anyways , glad to have been able to help. gr. Rlx 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.