Author Topic: objects connected via pline  (Read 296 times)

0 Members and 1 Guest are viewing this topic.

mbrandt5

  • Mosquito
  • Posts: 11
objects connected via pline
« on: July 14, 2017, 05:02:24 pm »
 :mrgreen:
So does anyone know of a lisp that exists that will do the following...trying to save myself the hassle of writing the code and scrambling the web.

-Prompt you to select multiple objects (Objects A)
       (Extract the base points of Objects A) -Store those Base points

-Select Object B
       (Extract the base points of Object B) -Store that Base point

-Draw polylines from basepoint of Objects A to base point of Object B via  90 degree angles

...A bonus would be if it did all of this within a selected polyline



Lee Mac

  • Seagull
  • Posts: 11704
  • AutoCAD 2015 Windows 7 London, England
Re: objects connected via pline
« Reply #1 on: July 15, 2017, 09:25:15 am »
A sample image/drawing would help  :-)

mbrandt5

  • Mosquito
  • Posts: 11
Re: objects connected via pline
« Reply #2 on: July 17, 2017, 11:58:13 am »
Sorry about that

- The Circles with A, are the group A objects (blocks)
- The Rectangle is the group B object
(The blue line is the polyline I was referring to that the lines would hopefully stay within, also if they followed same paths that'd be cool)

The ideal lisp would autopopulate the plines between the two groups
« Last Edit: July 18, 2017, 02:08:28 pm by mbrandt5 »

mbrandt5

  • Mosquito
  • Posts: 11
Re: objects connected via pline
« Reply #3 on: July 18, 2017, 04:29:50 pm »
If there isn't anything similar....

If anyone could suggest a reference lisp for the three things I'd need to figure out which would be...

1.Drawing a PLine to the x coordinate or y coordinate of object b...which with polar snap of 90 degrees maybe just entering the x and y coordinate would work??
This did not work by the way, would perfer to do this without extracting changing to numbers and subtracting "If possible"

2. Keeping the populated lines in the object?

3.Making the PLines turn? with other PLines?
Assuming it'll take estraction and subtraction of coord.s
« Last Edit: July 18, 2017, 05:25:08 pm by mbrandt5 »

ronjonp

  • Needs a day job
  • Posts: 6258
Re: objects connected via pline
« Reply #4 on: July 18, 2017, 05:41:16 pm »
So in your example, is object 'b' the base and is there only one? There are a few different routes at 90 degree angles.
« Last Edit: July 18, 2017, 05:50:12 pm by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

mbrandt5

  • Mosquito
  • Posts: 11
Re: objects connected via pline
« Reply #5 on: July 19, 2017, 09:10:53 am »
That is correct the plines could start at the base point, I believe CONS 10, that draw to the X or Y coords of each A object branching off as shown, in the picture above. 

I found a command online that draws plines from a common base point that is selected, which I could use as a good starting point.

Code: [Select]
DEFUN C:PBB ()
(PROMPT "\n*POLYLINE BY BASEPOINT* ")
(SETQ BP (GETPOINT "Specify base point: "))
(SETQ LP 1)
(WHILE LP
(COMMAND "PLINE" BP)
(SETQ LP2 1)
(WHILE LP2
(IF (= (GETVAR "CMDACTIVE") 1)
(PROGN
(PROMPT "\nSpecify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: ")
(COMMAND PAUSE)
);END PROGN
(SETQ LP2 NIL)
);END IF
);END LP
);END LP
(PRINC)
);END PBB

Also, not to familiar with VLAX, some experience. While this draws a line to a curve, I think its cons 10 first point cons 11 second, etc. 
I think some variation of this addition to that code could come i handy as well.

Code: [Select]
(entmake (list '(0 . "LINE") (cons 10 (trans BT 1 0))
(cons 11 (vlax-curve-getClosestPointTo entity (trans BT 1 0)))) ;_ list
) ;_ entmake

ronjonp

  • Needs a day job
  • Posts: 6258
Re: objects connected via pline
« Reply #6 on: July 19, 2017, 12:42:52 pm »
Something like this?  8)

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

MSTG007

  • Water Moccasin
  • Posts: 1952
  • I can't remeber what I already asked! I need help!
Re: objects connected via pline
« Reply #7 on: July 19, 2017, 01:18:02 pm »
Pretty crazy cool.
Autodesk Infrastructure Design Suite 2016

ronjonp

  • Needs a day job
  • Posts: 6258
Re: objects connected via pline
« Reply #8 on: July 19, 2017, 02:05:18 pm »

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

mbrandt5

  • Mosquito
  • Posts: 11
Re: objects connected via pline
« Reply #9 on: July 28, 2017, 03:01:03 pm »
That is exactly what I am looking for! :yay!: :yay!:

Any chance you'll share?

ronjonp

  • Needs a day job
  • Posts: 6258
Re: objects connected via pline
« Reply #10 on: July 28, 2017, 03:09:27 pm »
That is exactly what I am looking for! :yay!: :yay!:

Any chance you'll share?
I'll have to see if I can get it working again .. was messing around with other sorting algorithms and broke it  :oops: .

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

mbrandt5

  • Mosquito
  • Posts: 11
Re: objects connected via pline
« Reply #11 on: July 28, 2017, 03:35:38 pm »
Okaledokale!