Author Topic: lwpoly23dpoly - 3dpoly2lwpoly.lsp  (Read 6657 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #15 on: March 11, 2024, 11:24:05 AM »



your link does not works.

Marks for permalinks have changed at cadtutor...
Try this link instead :
https://www.cadtutor.net/forum/topic/37726-draw-polyline-along-with-2-or-more-adjacent-closed-polylines/?do=findComment&comment=378497

Dear Marko, ZIP file is unavailable for download at this link. Could you please share the ZIP file in this thread ?
Thanks.

It is available, you just have to be logged on cadtutor.net with secured method using your e-mail as username... I just downloaded it from there... So, here is it in this attachment...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Peter2

  • Swamp Rat
  • Posts: 650
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #16 on: March 13, 2024, 06:14:54 AM »
...but I could create a reproducible crash in Acad Map 2023...
Hi
some ideas?
Peter
Peter

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

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #17 on: March 13, 2024, 12:55:22 PM »
I don't have Acad Map 2023, so you'll have to debug it on your own... Sorry...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #18 on: March 13, 2024, 07:18:47 PM »
...but I could create a reproducible crash in Acad Map 2023...
Hi
some ideas?
Peter

@Peter
I can load the file in AutoCAD Vanilla, so :

How is the error reproducible ?
What was your workflow ( which of the files are you running ) ?

I think the error may be in a call to the Unit() function [ not "units" as you mention ].

A divide by zero is fairly easy to test for.

Regards,
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Peter2

  • Swamp Rat
  • Posts: 650
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #19 on: March 14, 2024, 03:30:42 AM »
Hi all

- the file contains only a standard 3dpoly, so it should be used in "every" software
- I have the same problem in Bricscad 23
- it works fine on thousands of lines, but stops with this line
- I use the code from the first posting here in this thread
- I call the function "3dpoly2lwpoly"
Code: [Select]
Befehl: 3DPOLY2LWPOLY
Pick 3dpolyline to convert to lwpolyline
; ----- LISP : Call Stack -----
; [0]...C:3DPOLY2LWPOLY
; [1].....ENTMAKELWPOLY3DPTS
; [2].......UNIT <<--
;
; ----- Error around expression -----
; '(0.0 0.0 0.0)
; in file :
; D:\Downloads\x.lsp
;
; error : divide by zero at [/]

(yes, it is in "defun unit.." and not in "defun units ...")
Peter

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

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #20 on: March 14, 2024, 04:54:30 AM »

Peter , what you renamed it to means nothing to me.

Which of the files in the  PLINETOOLS BY MR+GC+LM.zip is causing the problem ?
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Peter2

  • Swamp Rat
  • Posts: 650
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #21 on: March 14, 2024, 07:21:53 AM »
Hi kdub_nz
..Which of the files in the  PLINETOOLS BY MR+GC+LM.zip is causing the problem ?
None.
The problem of this thread is that it drifted away from the OT (a code posted in the first posting) to the discussion about the ZIP file.
I used the code here: https://www.theswamp.org/index.php?topic=42773.msg479708#msg479708 - and hoping, that it is still correct.
Peter

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

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #22 on: March 14, 2024, 10:36:25 AM »
@Peter2

Look, I've changed slightly (unit) sub function - first from beggining, not to throw "divide by zero" error, but I doubt that error is solved - it should passed and wihtout my intervention... Simply something is not good in the drawing... Like I said first 3 points define plane at which 3dpoly should be projected to lwpoly, and for lwpoly to 3dpoly, there should be no arced segments and it should perform conversion from any plane as lwpoly is planar entity... Are you sure your UCS is WCS before starting routine, if not, set it that way, but I think that that's not the problem...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #23 on: March 14, 2024, 10:41:02 AM »
I just saw : from error report...
You are using 3dpoly2lwpoly...
Why not just exploding 3dpoly and then change from Properties Z=0 (current UCS plane) join previous => lwpolyline, or => 3dpolyline if 3dpoly had one or more not coplanar vertices - you haven't specified Z=0 in UCS...
« Last Edit: March 14, 2024, 12:24:26 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #24 on: March 14, 2024, 12:35:39 PM »
Another issue :
Maybe your starting 3 vertices from 3dpoly don't define plane, but rather vector direction - they are collinear and coplanarity in it's real terms can't be assumed as unique... You can set infinitely number of planes passing through that vector... So for sure, I'd recommend that you write the code that is behaving like I described in previous post - EXPLODE => change Z=0 in current UCS (whatever orientation you want) and finally JOIN => lwpolyline...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #25 on: March 14, 2024, 12:46:18 PM »
Just watch out with JOIN command - there is bug...
So here is the link to overcome this issue : https://www.theswamp.org/index.php?topic=55918.0
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Peter2

  • Swamp Rat
  • Posts: 650
Re: lwpoly23dpoly - 3dpoly2lwpoly.lsp
« Reply #26 on: March 14, 2024, 01:42:27 PM »
Hi

I think I found the reason for the problem:
- The first and second point have a distance of  0.00224.
- I seems that this difference leads to a (rounded) 0 and to the division by 0
- also the command "list" tells something like "the first 3 points define no plane. No area calculated".

When I remove the second point, both the Lisp and the command "list" work fine.

And just while typing the strings "define no plane" I found the real problem - the weird issue with "dwgunits / not coplanar".
A well know issue for a long time ...
https://www.google.com/search?&q=dwgunits+not+coplanar

Thanks to all for their help and replies, especially to Marco.
Peter

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