Jump to content

Move block to block attribute insertionpoint


pmxcad

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • rlx

    14

  • pmxcad

    11

  • Grrr

    3

  • BIGAL

    2

Top Posters In This Topic

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 :P

Link to comment
Share on other sites

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 :sweat:

PmxCad_Relais.lsp

Edited by rlx
Link to comment
Share on other sites

Rlx, thats a very thematic function/variable naming! (CSI) :lol:

 

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)

Link to comment
Share on other sites

Rlx, thats a very thematic function/variable naming! (CSI) :lol:

 

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 :twisted: 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

Link to comment
Share on other sites

I just wanted it to read like a (crime) story :twisted: just for the fun of it.

 

Yeah, I had fun reading it! :D

 

 

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).

Link to comment
Share on other sites

Yeah, I had fun reading it!

 

Glad you liked it :D 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 by rlx
Link to comment
Share on other sites

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... :lol:

 

npp.jpg

 

Have a good weekend my friend!

 

gr. Rlx

 

Have a great one too, Rlx! :thumbsup:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

:beer:

 

 

 

gr. Rlx

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...