cadtischler Posted December 16, 2013 Share Posted December 16, 2013 Hello, is there a good way to compare two objects, if they are the same one ? Like the function in the screenshot by the link. But i need this function inside a script. So far i compare the type, class, 3DCTNR an others. But this is only a bad way, because the can be many mistakes. CompareObjects:=TRUE; IF GetTypeN(halt)<>GetTypeN(hneu) THEN CompareObjects:=FALSE; IF GetClass(halt)<>GetClass(hneu) THEN CompareObjects:=FALSE; Get3DCntr(halt,x1,y1,z1); Get3DCntr(hneu,x2,y2,z2); IF (ABS(x1-x2)>1) OR (ABS(y1-y2)>1) OR (ABS(z1-z2)>1) THEN CompareObjects:=FALSE; IF CompareObjects=FALSE THEN GOTO 100; Get3DInfo(halt,x1,y1,z1); Get3DInfo(hneu,x2,y2,z2); IF (ABS(x1-x2)>1) OR (ABS(y1-y2)>1) OR (ABS(z1-z2)>1) THEN CompareObjects:=FALSE; IF CompareObjects=FALSE THEN GOTO 100; IF GetTypeN(halt)=15 THEN { Symbol in Dokument } IF GetSymName(halt)<>GetSymName(hneu) THEN CompareObjects:=FALSE; IF GetTypeN(halt)=11 THEN BEGIN { tracking Gruppe } h1:=FInGroup(halt);h2:=FInGroup(hneu); bool:=CompareObjects(h1,h2); IF bool=FALSE THEN CompareObjects:=FALSE; END; HCenter(halt,x1,y1); HCenter(Hneu,x2,y2); IF (ABS(x1-x2)>1) OR (ABS(y1-y2)>1) THEN CompareObjects:=FALSE; IF CompareObjects=FALSE THEN GOTO 100; GetBBox(halt,x1,y1,z1,r1); GetBBox(hneu,x2,y2,z2,r2); IF (ABS(x1-x2)>1) OR (ABS(y1-y2)>1) OR (ABS(z1-z2)>1) OR (ABS(z1-z2)>1) THEN CompareObjects:=FALSE; 100: https://www.dropbox.com/s/ouw2uukhbr1fym0/Bildschirmfoto%202013-12-16%20um%2010.03.46.png Quote Link to comment
MullinRJ Posted December 16, 2013 Share Posted December 16, 2013 Hello Uwe, ???There is no easy way to make that comparison. I think it would be better if you structured your script to make comparisons guided by object type, since nearly every type has different attributes to compare. Some attributes are the same, like line weight and fill colors, but others differ in a broad way, like polygons have vertices but ovals do not. The 3D types will be the most difficult to test. I suggest you set up a case statement based on ObjectType and custom tailor each comparison that way. ObjTyp1 := GetTypeN(Halt); ObjTyp2 := GetTypeN(Hneu); CASE ???2: begin?? { Line } ?????????{ compare endpoints } ?????????{ compare line weight } ?????????{ compare line color } ?????????{ compare line style } ?????????{ compare plane - Screen, Layer, 3D } ???????end;???{ 2-Line } ???3: begin???{ Rect } ?????????{ compare BBox } ?????????{ compare rotation } ?????????{ compare line weight } ?????????{ compare line color } ?????????{ compare line style } ?????????{ compare fill color } ?????????{ compare fill pattern } ?????????{ compare plane } ???????end;???{ 3-Rect } ???{ etc. } END;???{ case } ???This is not a script you will finish in a day, or a week, but you can keep adding to it as you need to check different types. You can also start by checking basic properties, like BBox, Center, and Rotation, and expand your checking later to include vertex positions and vertex order. ???As you can see, this will be a very complicated script if you check everything. But depending on your needs, you may not have to compare everything or every object type which will simplify things considerably. ???All of this said, you should search a little on the web. One of the 3rd Party Developers has a compare utility for sale, but I've forgotten which one (I think it's VectorBits, but I'm guessing). I seriously doubt you can write your own for less than you can buy one today. Good luck, Raymond Quote Link to comment
Guest Frank Brault Posted December 16, 2013 Share Posted December 16, 2013 I think that it would be wise to start such a task would be to search iteratively throughout the document for objects at the same location. This would eliminate most of the false cases first. I would build a list of these to check more thoroughly in another step. To build such a list, you would have to check each document object against every other object in the document. But at the end, I think that you would have narrowed the task down to a (relatively) manageable one. Quote Link to comment
cadtischler Posted December 16, 2013 Author Share Posted December 16, 2013 Hello, thanks for your answers. @Raymond: This is the real perfect way. But to 'expensive' in time for this problem. There i had also to track in Groups, Symbols, and differ nearly 20 Types. @Frank: Yes, there is the problem of complexity. It is n^2 for n Objects. But it?s easy to make lists of objects in the same class, type or area, or anything else, to beware of 1000*1000=10^6 compares. So there are two ways: 1) "dirty compare" of some characteristics, ignore the details. 2) look for 3rd Party. I believe you, that a 3rd Party-Tool is better than 2 days working, or use the men?-command in an other turnarround. So i search the web. Thank you and greetings Uwe. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.