Pete_IC 发表于 2022-7-6 22:29:30

Interesting, im getting 2 different point locations for the polylines, but for the exploded lines i get the same location for the point
lcog.dwg

SEANT 发表于 2022-7-6 22:33:25

When I run it here I can only get the point on the right.I’m not sure why the point on the left would appear unless some of the geometry is not being processed correctly.Given the left shift, I assume some additional geometry is included left of center, or some geometry is being missed right of center.
 
I won’t have any more time tonight but will take another peak at the situation tomorrow morning.

SEANT 发表于 2022-7-6 22:34:31

Ah yes, there was a bug.One of my steps was out of sequence and allowed processing geometry twice given a multiple crossing window selections.
 
The first post has been updated with the corrected code.

SEANT 发表于 2022-7-6 22:38:51

The selection process was not very user friendly in the original; I modified it a bit for a more AutoCAD like feel.
 
Modified source code is available if necessary.
LCOG_rev3.zip

RMS 发表于 2022-7-6 22:41:05

 
OMG C# ....breath deep, its really just VB with some curly things {}.....and
and the comments are like C/C++
 
Nice Job Sean! I can see we have some Naval Architects / boat buildershereand that is awesome!

emarijt 发表于 2022-7-6 22:45:38

I'm trying to load the dll file but something is going wrong. Can someone help me out?
 
This is what i get:
-----------------------------
 
Command: NETLOAD
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///C:\Program Files\Autodesk\AutoCAD 2011\LCOG.dll'
or one of its dependencies. The module was expected to contain an assembly
manifest.
File name: 'file:///C:\Program Files\Autodesk\AutoCAD 2011\LCOG.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at loadmgd()
 
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
(DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure
logging.
To turn this feature off, remove the registry value
.
 
Thanx in advance

SEANT 发表于 2022-7-6 22:48:38

Preliminary investigation suggests this to be a problem with 32bit/64bit compatibility.What version of AutoCAD 2011 are you using?

emarijt 发表于 2022-7-6 22:50:25

thanks for your reply. I'm running AutoCAD 2011 on a 32bit machine.

SEANT 发表于 2022-7-6 22:55:44

Due to more specific targeting, this version may perform better.
LCOG.zip

emarijt 发表于 2022-7-6 22:57:08

It works great! Thanks a lot!
页: 1 [2]
查看完整版本: .NET - Find COG of linear elem