Author Topic: Aline Block to polyline..  (Read 3642 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Aline Block to polyline..
« on: December 05, 2006, 11:36:58 AM »
Hi all..

Before making a new program..
I would like to see if is exist..

the program must aline all selected block to a polyline in one selection..
(see sceenshot)

If any of you know any program doing something similar..i'll be glad to see it.

thanks every  one and have a good day.  :angel:
Keep smile...

Guest

  • Guest
Re: Aline Block to polyline..
« Reply #1 on: December 05, 2006, 11:46:38 AM »
Two things that come to mind are:

1) The measure command and
2) Use the ALIGN parameter of Dynamic Blocks.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Aline Block to polyline..
« Reply #2 on: December 05, 2006, 12:02:31 PM »
Two things that come to mind are:

1) The measure command and
2) Use the ALIGN parameter of Dynamic Blocks.
I was thinking measure first, but then I looked at the picture, and I don't think measure would work, as it only allows one distance between blocks, and in the pic they are not evenly spaced.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: Aline Block to polyline..
« Reply #3 on: December 05, 2006, 12:04:36 PM »
Quote
I was thinking measure first, but then I looked at the picture, and I don't think measure would work, as it only allows one distance between blocks, and in the pic they are not evenly spaced.

I guess that brings up the question: 'Do they NEED to be spaced evenly or can they be more sporadic?'

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Aline Block to polyline..
« Reply #4 on: December 05, 2006, 12:10:59 PM »
Quote
I was thinking measure first, but then I looked at the picture, and I don't think measure would work, as it only allows one distance between blocks, and in the pic they are not evenly spaced.

I guess that brings up the question: 'Do they NEED to be spaced evenly or can they be more sporadic?'
I looks like it is one per segment of the polyline.  Just a guess though.  And I haven't dug into dynamic blocks yet, so if you know that the align property would work, then I would think one would just need to write the routine to insert them per segment, and then use the align property.  Doesn't make it sound to hard.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: Aline Block to polyline..
« Reply #5 on: December 05, 2006, 12:15:20 PM »
Here is a start:

Code: [Select]
(setq ename (car (entsel "\nSelect block: ")))
(setq curve (car (entsel "\nSelect polyline: ")))
(setq pt (getpoint "\nPoint insertion: "))
(setq param (vlax-curve-getparamatpoint curve pt))
(setq a (vlax-curve-getpointatparam curve (fix param)))
(setq b (vlax-curve-getpointatparam curve (1+ (fix param))))
(vla-put-rotation (vlax-ename->vla-object ename) (angle a b))

HTH

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Aline Block to polyline..
« Reply #6 on: December 05, 2006, 01:43:53 PM »
Thanks LE..

I use your code..

Code: [Select]
(defun c:Qalin ()
 
 (setq bname (ssget '((0 . "INSERT"))))
  (if (not bname)
    (progn
      (alert " Aucune entité n'a été sélectionné.")
      (exit)
    )
    (bnamecheck)
  )
)

(defun bnamecheck (/ curve sscount val1 ename pt param a b )
(setq curve (car (entsel "\nSélectionnez votre Polyligne: ")))
  (if curve
    (progn 
(setq sscount (sslength bname))
(setq val1 (- sscount 1))
(repeat sscount
(setq ename (entget (ssname bname val1)))
(setq pt (cdr (assoc 10 ename)))
(setq param (vlax-curve-getparamatpoint curve pt))
(setq a (vlax-curve-getpointatparam curve (fix param)))
(setq b (vlax-curve-getpointatparam curve (1+ (fix param))))
(vla-put-rotation (vlax-ename->vla-object (cdr (assoc -1 ename))) (angle a b))
(setq val1 (- val1 1))
))
(alert "Aucune Polyligne n'a été sélectionnée.")
))

Thanks guys.....i appreciate.
in fact can't use measure.....(not equal space between blocks..)

 :wink:

« Last Edit: December 05, 2006, 01:58:24 PM by Andrea »
Keep smile...

LE

  • Guest
Re: Aline Block to polyline..
« Reply #7 on: December 05, 2006, 02:13:53 PM »
You are welcome. :)

gile

  • Gator
  • Posts: 2518
  • Marseille, France
Re: Aline Block to polyline..
« Reply #8 on: December 05, 2006, 04:44:35 PM »
Perhaps I'm too late, but you can also use vlax-curve-getFirstDeriv, it will work on polyarcs splines and so on ...

Code: [Select]
(setq ename (car (entsel "\nSelect block: ")))
(setq curve (car (entsel "\nSelect polyline: ")))
(setq pt (getpoint "\nPoint insertion: "))
(setq param (vlax-curve-getparamatpoint curve pt))
(setq deriv (vlax-curve-getFirstDeriv curve param))
(vla-put-rotation (vlax-ename->vla-object ename) (angle pt (mapcar '+ pt deriv)))

« Last Edit: December 06, 2006, 12:06:35 AM by gile »
Speaking English as a French Frog

Jochen

  • Newt
  • Posts: 30
Re: Aline Block to polyline..
« Reply #9 on: December 06, 2006, 03:18:29 AM »
Seems to be similar to the TRAKTRIX-problem.
Regards
Jochen

www.black-cad.de