Author Topic: Calcualting the visible length of polylines?  (Read 1159 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 653
Calcualting the visible length of polylines?
« on: October 21, 2016, 09:54:22 AM »
I have a group of closed polylines (4 vertices), where some parts (sections) are overlaying with other sections of other polylines. I have to calculate the length of visible sections; the hidden sections have to be ignored.

In the meantime I could solve the problem with identical lines (see example - the short lines in the middle of the drawing), but how to check the overlaying lines with different length (e.g. the short red and the longer green line)?

Or is there a command (function) which can solve it with one click?

Edit:
Adding more details ...
- The plines don't have different colours "in reality". I just coloured them to better show the course of the plines.
- The original plines should stay unmodified, so "explode / flatten / overkill" can not be used or has to be restored in a secure way.
- After drawing the plines, I have a list with all vertices and all "unique" segments (doubled segments are already removed, overlapping segments not)
« Last Edit: October 21, 2016, 12:59:06 PM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Calcualting the visible length of polylines?
« Reply #1 on: October 21, 2016, 10:45:37 AM »
No time to explore this one but what if you explode to lines & use the Express Tools FLATTEN OVERKILL command?
I thought it would join lines that overlapped.

Edit: Thanks Marko, I miss remembered the name.
« Last Edit: October 21, 2016, 03:48:39 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ChrisCarlson

  • Guest
Re: Calcualting the visible length of polylines?
« Reply #2 on: October 21, 2016, 11:49:45 AM »
I'm not sure where the draworder of an object is stored. Potentially in a dictonary of the entity? From a drawing standpoint, trimming or breaking the lower line would solve quite a few headaches.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Calcualting the visible length of polylines?
« Reply #3 on: October 21, 2016, 12:32:55 PM »
Here, I've created LISP for you, but what I've found while writing it is that "cdorder.lsp" from Express Tools had lack, so I've incorporated it inside lisp in it's entirety with my mod. - I am using A2014, so bear me if you have other one correct, but I doubt... Also incorporated (plintav) sub and (overkill-MR) sub made by me... Before you start routine make sure CDORDER is correct - my lisp is working only with DXF 62 code of colors so only ACII colors - not true colors... Upon finishing routine it will UNDO changes made while processing and if you haven't done anything meanwhile - you just opened DWG, it may ask to UNDO everything to beginning of DWG session - just answer "Y"...

I hope it will help you...
Regards, M.R.
« Last Edit: October 22, 2016, 05:33:50 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Peter2

  • Swamp Rat
  • Posts: 653
Re: Calcualting the visible length of polylines?
« Reply #4 on: October 21, 2016, 01:14:39 PM »
To all - I modified my first post with additional information:
Quote
Adding more details ...
- The plines don't have different colours "in reality". I just coloured them to better show the course of the plines.
- The original plines should stay unmodified, so "explode / flatten / overkill" can not be used or has to be restored in a secure way.
- After drawing the plines, I have a list with all vertices and all "unique" segments (doubled segments are already removed, overlapping segments not)

@ribarm
Thanks. I tried your lisp, but at first I get
Code: [Select]
Determining unique colors..\Done.
no function definition: ACET-CDORDER

After manually loading ACET-CDORDER I get (after exploding the Plines)
Code: [Select]
Objekte wählen:
; Fehler: Fehlerhafter Argumenttyp: lselsetp nil

I have to look more closely.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Calcualting the visible length of polylines?
« Reply #5 on: October 21, 2016, 01:51:44 PM »
Look I've found one more thing in "cdorder.lsp", so I reattached both lisps... While executing lisp for your request I had no problems in A2014... For your additional info, you'd better color your plines, so you can know what you're searching for IMHO...

M.R.
(Hope you'll find answers soon...)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Calcualting the visible length of polylines?
« Reply #6 on: October 22, 2016, 05:33:28 AM »
Hi again, I've reattached lisp once again... Now it's necessarily must executing CDORDER command before routine...
My last revision :
Quote
  (plintav ss)
  (acet-cdorder (setq ss (ssget "_P")) (acet-getvar '("ACET-CDORDER-LOCATION" 3)) (acet-cdorder-ss-colors (setq ss (ssget "_P"))) (if (= (acet-getvar '("ACET-CDORDER-BLOCKS" 3)) 1) "Yes" "No") (acet-getvar '("ACET-CDORDER-MODE" 1)))
  (setq lst (acet-cdorder-ss-colors (setq ss (ssget "_P"))))
  (if (= (acet-getvar '("ACET-CDORDER-LOCATION" 3)) "Back")
    (setq lst (reverse lst))
  )

  (setq ssli (ssadd))

That's all... Should work fine and if you set in dialog box "Back" option...
M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube