0 Members and 1 Guest are viewing this topic.
Alan, you are confusing me! I am so out of practice! How would I use this?John
(_structurePosition <vla-object>)(_pipeStartEndStructurePosition <vla-object>)
(defun _pipeStartEndStructurePosition (pipe / lst) (if (vl-some 'and (setq lst (mapcar (function (lambda (structure / s p) (if (setq s (vlax-get pipe structure)) (mapcar 'vlax-get (list (setq p (vlax-get s 'Position)) p p) '(x y z)) ) ) ) '(StartStructure EndStructure) ) ) ) lst ))
PS: Please avoid using tabs in code, they are annoying
Code: [Select] (setq TextSel (ssget "_X" (list '(0 . "TEXT") (list 10 (vlax-get structurepos 'x) (vlax-get structurepos 'y) 0.0) ) ) )
(setq TextSel (ssget "_X" (list '(0 . "TEXT") (list 10 (vlax-get structurepos 'x) (vlax-get structurepos 'y) 0.0) ) ) )
(if (> (setq SelectionSet (ssget "X" (list (cons 0 "AECC_STRUCTURE")))) Nil ) (progn (setq Objectctr 0) (repeat (sslength SelectionSet) (setq Item (ssname SelectionSet Objectctr)) (setq Item (vlax-ename->vla-object Item)) (setq StructureName (vla-get-name Item)) (setq StructurePos (vla-get-position Item)) (setq StructureIns (list (vlax-get structurepos 'x) (vlax-get structurepos 'y) (vlax-get structurepos 'z) ) ) (progn (setq TextSel (ssget "_X" (list '(0 . "TEXT") (list 10 (vlax-get structurepos 'x) (vlax-get structurepos 'y) 0.0 ) ) ) ) (if TextSel (repeat (setq Ctr (sslength TextSel)) (setq Ctr (1- Ctr)) (setq TextItem (ssname TextSel Ctr)) (setq TextItem (vlax-ename->vla-object TextItem)) (if (= (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint TextItem) ) ) (list (car StructureIns) (cadr StructureIns) 0.0) ) (setq TextString (vla-get-TextString TextItem)) ) ) ) ) (vla-put-name Item TextString) (setq Objectctr (1+ Objectctr)) ) ) )
Quote from: Lee Mac on June 20, 2013, 08:14:27 AMPS: Please avoid using tabs in code, they are annoying I hear you, but I have just got 2014 and haven't had time to set things up properly.QuoteCode: [Select] (setq TextSel (ssget "_X" (list '(0 . "TEXT") (list 10 (vlax-get structurepos 'x) (vlax-get structurepos 'y) 0.0) ) ) )Thanks Lee, but this is still not working!Here is the deal....I have a civil 3d Model, I also have a piece of text at the insertion of each Structure which needs to become the structure name.........I am trying to catch each piece of text at each Structure insertion point and rename the structure.My code:Code: [Select](if (> (setq SelectionSet (ssget "X" (list (cons 0 "AECC_STRUCTURE")))) Nil ) (progn (setq Objectctr 0) (repeat (sslength SelectionSet) (setq Item (ssname SelectionSet Objectctr)) (setq Item (vlax-ename->vla-object Item)) (setq StructureName (vla-get-name Item)) (setq StructurePos (vla-get-position Item)) (setq StructureIns (list (vlax-get structurepos 'x) (vlax-get structurepos 'y) (vlax-get structurepos 'z) ) ) (progn (setq TextSel (ssget "_X" (list '(0 . "TEXT") (list 10 (vlax-get structurepos 'x) (vlax-get structurepos 'y) 0.0 ) ) ) ) (if TextSel (repeat (setq Ctr (sslength TextSel)) (setq Ctr (1- Ctr)) (setq TextItem (ssname TextSel Ctr)) (setq TextItem (vlax-ename->vla-object TextItem)) (if (= (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint TextItem) ) ) (list (car StructureIns) (cadr StructureIns) 0.0) ) (setq TextString (vla-get-TextString TextItem)) ) ) ) ) (vla-put-name Item TextString) (setq Objectctr (1+ Objectctr)) ) ) )Can anyone help?Thanks in advance.John
Thanks Lee,Tolerance................ Something I am short off, but what the code needed!!!Turns out, the text was not exactly on the insert of the structure.Alan,That is all we use as well! Thanks for all your help guys.John
That is a good idea Alan, even with Lee's code I still had a fair bit of manual cleaning to do as it didn't catch all the text. Then there was the issue of duplicate numbers. ( its a complicated system!!)Unfortunately I am going to have to leave it until I have to do it again or until I get free time, as I now have to rename all the associated alignments!! Thanks for your help.John