TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: civil.eng on August 16, 2021, 09:37:40 AM

Title: Geometric Center is not proper
Post by: civil.eng on August 16, 2021, 09:37:40 AM
Hi all,
I have a weird problem with some polygons in cad, Geometric Center is not accurate in the attached file.
I also checked polygons out with LM:PolyCentroid function and the function shows center wrong too.

Does someone tell me what the problem is?
Title: Re: Geometric Center is not proper
Post by: mhupp on August 16, 2021, 10:34:54 AM
How are you generating those points? Red is what I'm coming up with for geo center.

I have these settings load every time i open a drawing. maybe check out the one about polylines

Code: [Select]
(setvar 'INSUNITS 1)        ; Sets the Drawing units to inches
(setvar 'THICKNESS 0)     ; Sets THICKNESS TO 0
(setvar 'CECOLOR "BYLAYER") ; Sets color property to "BYLAYER."
(setvar 'CELTYPE "BYLAYER") ; Sets linetype property to "BYLAYER."
(setvar 'CELWEIGHT -1)      ; Sets the lineweight to "BYLAYER."
(setvar 'CELTSCALE 1)       ; Sets the LTScale of new objects to 1.
(setvar 'plinetype 2)       ; convents all 2D polylines to optimized polylines 
(setvar 'auprec 4)        ; angular unit percision 0.0000
(setvar 'luprec 4)        ; linear unit percision 0.0000
(setvar 'selectionmodes 0)  ; Set Selection mode to 0
(setvar 'lunits 2)        ; Set Linear units to Decimal
(setvar 'perspective 0)   ; Turn off Perspective view in current viewport
(setvar 'saveformat 8)    ; Set save to 2010 DXF
Title: Re: Geometric Center is not proper
Post by: ronjonp on August 16, 2021, 11:41:55 AM
Work for me:
Title: Re: Geometric Center is not proper
Post by: d2010 on August 16, 2021, 01:42:39 PM
I have a weird problem with some polygons in cad, Geometric Center is not accurate in the attached file.
Does someone tell me what the problem is?
In my source bellow work fine. I use LeeMac_Centroid have no bugError.
You always, you keep the "Osmode"=207, otherwise the programe.lsp
                (rtFail  "pp_civileng_leecentroid_autoexec_jcpin25.lsp")
You found the sourceEncrypted, here on nextLine
(Click Here,Click Here) (https://www.theswamp.org/index.php?action=dlattach;topic=56961.0;attach=38535)
If you need the source'NativeDef (not protected in ascii.lisp) (Not jc_pin25)
--> then  you replay here.
Title: Re: Geometric Center is not proper
Post by: civil.eng on August 17, 2021, 03:00:44 PM
Thank you guys, I think it's a bug because the problem only happens on Autocad 2017 and Autocad 2019, have you guys checked it on the versions?