Author Topic: Route map  (Read 410 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 80
Route map
« on: July 24, 2022, 12:06:23 PM »
Help to make a route for the below Image

When I choose Initget & select the polyline it should change.

« Last Edit: July 24, 2022, 12:10:15 PM by mohan »
"Save Energy"

Lee Mac

  • Seagull
  • Posts: 12696
  • London, England
Re: Route map
« Reply #1 on: July 25, 2022, 05:38:33 PM »


BIGAL

  • Swamp Rat
  • Posts: 1037
  • 40 + years of using Autocad
Re: Route map
« Reply #2 on: July 25, 2022, 08:38:08 PM »
Is the line work plines and lines ?
Should the new offset lines be added or original erased ?
What layers ?
What colors ?

It would not be hard to do something in lisp.

A man who never made a mistake never made anything

mohan

  • Newt
  • Posts: 80
Re: Route map
« Reply #3 on: July 26, 2022, 02:27:27 AM »
Choose layers like example Main route, Sub route & Local route, (I can also change as per my requirement later)
All of them are Polyline
Original should not erase. (Attached Image)
"Save Energy"

BIGAL

  • Swamp Rat
  • Posts: 1037
  • 40 + years of using Autocad
Re: Route map
« Reply #4 on: July 26, 2022, 10:28:28 PM »
Try this

Code: [Select]
;  http://www.theswamp.org/index.php?topic=57731.0
; multi offset plines by Alanh July 2022

(defun c:coloroffs ( / ans obj obj2 col1 col2 off1 off2w )
(vl-load-com)
(if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already
(if (= ahdef nil)(setq ahdef 1)) ; this is needed to set default button
; you can reset default button to user pick
(setq ans (ah:butts ahdef "V"   '("Please choose " "Main" "Sub" "Local" ))) ; ans holds the button picked value as a string
(setq ahdef but)

(cond
  ((= ans  "Main")(setq off1 3.5 off2w 2.0 cent 5.0 col1 7 col2 1))
  ((= ans  "Sub")(setq off1 2.5 off2w 1.5 cent 3.0 col1 7 col2 50))
  ((= ans  "Local")(setq off1 1.5 off2w 1.0 cent 1.5 col1 7 col2 92))
)

(setq obj (vlax-ename->vla-object (car  (entsel "Pick pline "))))
(vlax-put obj 'color col1)
(vlax-put obj 'constantWidth cent)

(vla-offset obj off1)
(setq obj2 (vlax-ename->vla-object  (entlast)))
(vlax-put obj2 'color col2)
(vlax-put obj2 'constantWidth off2w)

(vla-offset obj (- off1))
(setq obj2 (vlax-ename->vla-object  (entlast)))
(vlax-put obj2 'color col2)
(vlax-put obj2 'constantWidth off2w)

(princ)
)
A man who never made a mistake never made anything

mohan

  • Newt
  • Posts: 80
Re: Route map
« Reply #5 on: July 27, 2022, 11:04:35 AM »
Try this
That was amazing ! Thank you so much. . .  :smitten:
"Save Energy"

ronjonp

  • Needs a day job
  • Posts: 7437
Re: Route map
« Reply #6 on: July 27, 2022, 11:30:33 AM »
If these lines are already layered this could be optimized for a selection set rather than picking one at a time.

Also, why not just make a different linetype for each of these to differentiate them?

Windows 11 x64 - AutoCAD /C3D 2022

Custom Build PC

mohan

  • Newt
  • Posts: 80
Re: Route map
« Reply #7 on: July 28, 2022, 10:09:49 AM »
I have tried for Multiple selection but still more to do ! :sick:

Code - Auto/Visual Lisp: [Select]
  1. (if (setq sel (ssget ":L" '((0 . "LWPOLYLINE") (100 . "AcDbPolyline") (8 . "-TEXT"))))
  2. (repeat (setq idx (sslength sel))
  3.         (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
"Save Energy"

ronjonp

  • Needs a day job
  • Posts: 7437
Re: Route map
« Reply #8 on: July 28, 2022, 05:17:24 PM »
I have tried for Multiple selection but still more to do ! :sick:

Code - Auto/Visual Lisp: [Select]
  1. (if (setq sel (ssget ":L" '((0 . "LWPOLYLINE") (100 . "AcDbPolyline") (8 . "-TEXT"))))
  2. (repeat (setq idx (sslength sel))
  3.         (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
Your filter is only grabbing polylines on a "-TEXT" layer?

Windows 11 x64 - AutoCAD /C3D 2022

Custom Build PC

57gmc

  • Newt
  • Posts: 144
Re: Route map
« Reply #9 on: July 28, 2022, 05:50:32 PM »
Choose layers like example Main route, Sub route & Local route, (I can also change as per my requirement later)
All of them are Polyline
Original should not erase. (Attached Image)

I think you should be using the Map 3D toolset that comes with AutoCAD. What you're trying to do is called GIS. The different line styles can be styled using Map's tools. You can have complex line styles like you want. That's how all GIS is done.
« Last Edit: July 28, 2022, 06:09:15 PM by 57gmc »

BIGAL

  • Swamp Rat
  • Posts: 1037
  • 40 + years of using Autocad
Re: Route map
« Reply #10 on: July 28, 2022, 11:42:11 PM »
Like ronjonp you can use a filter "main,sub,local" for the layers then get each pline and check the layer so where I ask is "main" etc just use a check what layer instead.

Please confirm your layer names, then all can be done in one go. Can do select an object get its layer name but use "Main" as line style.
A man who never made a mistake never made anything