Jump to content

Recommended Posts

Posted

Updated this image, pBe. Does this help?

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Ohnoto

    16

  • pBe

    11

  • resullins

    1

Top Posters In This Topic

Posted Images

Posted
Updated this image, pBe. Does this help?

 

 

yes it does help

 

I'll have look at the code it later :)

Posted

Okay Ohnoto, you need to inverstigate something for me, this is key, so you need to be sure.

Of your blocks listed is there only one Move parameter for each block?

 

You notice (nth 15 ...) on the previous code? that is X&Y point for that block. i'm not sure if thats the same case with the rest of your blocks

 

if you can check/verify that theres only one move parameter on all your blocks and its having the same name as your sample drawing

, we can work it in such a way that there's no danger of retriving wrong data.

Posted

When I first created these blocks they did only have one move parameter, labeled as Stationing Move. I finally did add one more move parameter to each of them, but left the name as the default of "Position#", but still left the original ones, of course.

 

I linked these moves together within the block, so that when one moves the text, the other move parameters move as well. This was to make them a bit more user friendly when lining up strings of text close to each other.

 

Before I added the extra move parameter to these, I did spend a couple days thinking if this LISP would affect the blocks, but at the end thought that it wouldn't matter, thinking the parameter could be selected based on the parameter name, or with the parameters being linked together, it would work just the same.

 

Below is one such update block.

fiber marker tube.dwg

Posted (edited)

Try this for now

 

 
(defun c:AlgnDyn (/ adoc a b p10 p11 BaseXBlock PropName num selset )
 (vl-load-com)
 ;;  pbe May2011  ;; 
 (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
 (cond ((and    
 (setq a (car (entsel "\nSelect Reference Line:")))
 (eq (cdr (assoc 0 (setq b (entget a)))) "LINE")
 (setq p10 (cdr (assoc 10 b))
       p11 (cdr (assoc 11 b)))
 (if (= (car p10) (car p11))
       (setq  BaseXBlock  (car p10)
              PropName "Stationing Move X" num 0)
      (setq  BaseXBlock (cadr p10)
              PropName "Stationing Move Y" num 1))
 (ssget ":L" '((0 . "INSERT") (66 . 1)))
 (vlax-for
    Dblks (setq selset (vla-get-activeselectionset adoc))
   (setq MoveXVal
      (nth num
        (vlax-safearray->list
          (variant-value (vla-get-insertionpoint Dblks))
          )
        )
     )
(setq Station
       (vl-remove-if-not '(lambda (x)
       (eq                          
       (vlax-get x 'PropertyName) PropName))
       (vlax-invoke Dblks 'GetDynamicBlockProperties)))
       (vla-put-value
     (car Station)
     (- BaseXBlock MoveXVal)
     )
   )
[color=blue] (vla-delete selset)
[/color]  )
        )
       )
     
 (princ)
 )

 

its a draft, only works with left and downwards direction.

tested on the attached file

fiber marker tube.dwg

Edited by pBe
Posted

Using the same drawing I get the error:

 

error: bad argument type: VLA-OBJECT nil

 

It stops before after I select the line, and never prompts for me to select the blocks.

Posted
Using the same drawing I get the error:

 

error: bad argument type: VLA-OBJECT nil

 

It stops before after I select the line, and never prompts for me to select the blocks.

 

the error was the result of the misplaced (vla-delete Selset).

 

the conditions on this poorly written code :lol: is selecting a LINE (not polyline). another is it should be a straight line (horizontally and veritcally)

i want you try it out on all your blocks with those conditions ,that way we can figure out wehat need to be fixed

 

sorry for that ohnotto :)

Posted

I saw line, but didn't connect it in my head... out of habit. I repathed my line to be pline since I can do more with those than a regular line. So part of that issue could be my side also.

 

Edit... that was the issue, simple fix. I'll test it out and let you know any other issues

 

Edit again... Only about half of the blocks lined up to the line. I also tested this on a rotated viewport, where the line was straight and the blocks didn't move anywhere near the reference line. I can send you these blocks, but would prefer to do via email.

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