TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mbrandt5 on July 14, 2017, 05:02:24 PM

Title: objects connected via pline
Post by: mbrandt5 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


Title: Re: objects connected via pline
Post by: Lee Mac on July 15, 2017, 09:25:15 AM
A sample image/drawing would help  :-)
Title: Re: objects connected via pline
Post by: mbrandt5 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
Title: Re: objects connected via pline
Post by: mbrandt5 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
Title: Re: objects connected via pline
Post by: ronjonp 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.
Title: Re: objects connected via pline
Post by: mbrandt5 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
Title: Re: objects connected via pline
Post by: ronjonp on July 19, 2017, 12:42:52 PM
Something like this?  8)
Title: Re: objects connected via pline
Post by: MSTG007 on July 19, 2017, 01:18:02 PM
Pretty crazy cool.
Title: Re: objects connected via pline
Post by: ronjonp on July 19, 2017, 02:05:18 PM
Pretty crazy cool.
Thanks :)
Title: Re: objects connected via pline
Post by: mbrandt5 on July 28, 2017, 03:01:03 PM
That is exactly what I am looking for! :yay!: :yay!:

Any chance you'll share?
Title: Re: objects connected via pline
Post by: ronjonp 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: .
Title: Re: objects connected via pline
Post by: mbrandt5 on July 28, 2017, 03:35:38 PM
Okaledokale!
Title: Re: objects connected via pline
Post by: mbrandt5 on August 17, 2017, 10:55:48 AM
Any luck NinJon
Title: Re: objects connected via pline
Post by: ronjonp on August 17, 2017, 11:48:26 AM
I have not had time to look at this. Sorry.
Title: Re: objects connected via pline
Post by: ribarm on August 19, 2017, 03:19:38 PM
Regards, M.R.
Title: Re: objects connected via pline
Post by: mbrandt5 on August 22, 2017, 02:43:04 PM
That code is pretty cool...would you share?
Title: Re: objects connected via pline
Post by: ribarm on August 22, 2017, 06:24:27 PM
But this is my work... You could appreciate that I shared it... Now I hope you'll use them well in your task, otherwise if all this was just for fun, I'll stop doing this and never post a code again...

M.R.

[EDIT : Attached lisps removed from attachment due to lack of appreciation by OP personality...]
Title: Re: objects connected via pline
Post by: mbrandt5 on August 23, 2017, 09:05:31 AM
Thanks ?  :idea:
Title: Re: objects connected via pline
Post by: mbrandt5 on August 23, 2017, 09:09:20 AM
While I understand you not wanting to give your code away...I've done that if I thought there was something to gain.  Could you share pointers of what codes you used to do this so I can have an idea of where to start.  If this is something your trying to market I understand and far well.
Title: Re: objects connected via pline
Post by: ribarm on August 23, 2017, 10:44:46 AM
Send me an e-mail on : ribarm@gmail.com and I'll send you routines...
Title: Re: objects connected via pline
Post by: Lee Mac on August 23, 2017, 12:19:24 PM
If this is something your trying to market I understand and far well.

I would sincerely hope that this isn't the case, given that this would violate the use of my code in the program...
Title: Re: objects connected via pline
Post by: ribarm on August 23, 2017, 01:07:37 PM
No this isn't the case, I won't sell it, but neither I don't want to attach it again... And I improved it further more and also added version for all 2d curve types, tested it on various 3d positions where UCS follows boundary curve...
BTW. I see that you download it, Lee...