Jump to content

Thomas W

Member
  • Posts

    102
  • Joined

  • Last visited

Everything posted by Thomas W

  1. Ok Raymond, Thank you for your return, so I will leave vsoStateClear() as the last statement in event 3 (kResetEventID), I didn't directly see any difference on this example that's why I asked! Have a great day, Thomas
  2. Without copying and pasting text and writing the code directly, it doesn't seem to make any mistakes. I copy either from vector or from a text file. Below is a test by rewriting the lines after : dupeHand := CreateDuplicateObject(path, objHand); IF GetObjBeginningMarker(objHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility) THEN B := SetObjBeginningMarker(dupeHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); If GetObjEndMarker(objHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility) THEN B := SetObjEndMarker(dupeHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); END;{ if then begin } { vsoStateClear(objHand); } END;{ kResetEventID } With this function the script works like with the old function, I just don't know if it is necessary or if it is advisable to put vsoStateClear(objHand); before the end of KResetEventID? Thanks,
  3. just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code just ten line of code
  4. When I just reply with text it works I don't get a 403 error. As soon as I want to put code either with the add code function or by pasting the raw text it gives me a 403 error, if I paste a text file it's the same. I just replied to a message in my inbox and I have the same problem. I'm having a hard time understanding the cause of all this...
  5. Test message without code Hello, I modified the script version above to make the plugin work with the new functions Get/SetObjBeginningMarker and Get/SetObjEndMarker. I found a script where @MullinRJ uses these functions here : Convert Objects in Symbol to ByClass The script below now works for me without crashing vectorworks, with a 2d polygon plugin and runtime options enabled. I just don't know if it is advisable to put a vsoStateClear function before the end of kResetEventID, if anyone has an opinion on this point I would appreciate it! Could someone tell me how to remove the attachments from the above post and how to change the title of the post? Thanks and good day!
  6. Well I can no longer put a code snippet in the message, I get a 403 error each time, I restarted, disconnected from the forum and reconnected, the same.... So I want to put the script as a text file as an attachment, but it make an other error code -200
  7. The script below now works for me without ceashing vectorworks, with a 2d polygon plugin and runtime options enabled. I just don't know if it is advisable to put a vsoStateClear function before the end of kResetEventID, if anyone has an opinion on this point I would appreciate it!
  8. Sorry I had a 403 error when i wanted to answer... (?)
  9. Hello, I modified the script version above to make the plugin work with the new functions Get/SetObjBeginningMarker and Get/SetObjEndMarker.
  10. Thank you for your feedback on the history of markers. I must have made errors while writing the script and calling Get/SetObjBeginningMarker and Get/SetObjEndMarker or vsoStateClear(objHand). Version 081 of .vso crashes vectorworks when I change fills or colors, while version 08 with deprecated procedures works! If anyone sees what's wrong with writing the script... Thanks!
  11. Attached are the 2 versions in .vso Version 08 is as in the example and version 081 is with functions Get/SetObjBeginningMarker and Get/SetObjEndMarker. If in version 081 you put vsoStateClear(objHand); in comment or if you delete it vectorworks crashes. I was wondering why this was not the case in version 08 with Get/SetObjArrow procedures. Thanks, 08-PathAcceptMarkersAttr.vso 081-PathAcceptMarkerAttr.vso
  12. Hello, I'm new to the use of plug-ins, so I started by doing the various exercises of VS:Object_Events to understand the basis of operation and by looking for function examples on the forum and some information in these 2 files: MiniCadHookIntf. h and MiniCadCallBacks.h There is a lot of information, but it is interesting! I have a question about example 8: At the bottom of Example 8 it is stated that Get/SetObjArrow are deprecated since 2008 and it is advised to use Get/SetObjBeginningMarker and Get/SetObjEndMarker. According to my tests Get/SetObjArrow still works and using Get/SetObjBeginningMarker and Get/SetObjEndMarker you have to add vsoStateClear(objHand) before the end of kResetEventID otherwise vectorworks crashes when changing color or fill of 2d polygon. Is this the right solution and why should we do it on one function and not the other? Since in the explanation of VS:vsoStateClear it says "Must be called during the regen event 3 (kParametricRecalculate)" I wonder if this is also valid for kResetEventID. Below is the plugin script made with a 2d polygon and enabled for events. PROCEDURE Example081; CONST kObjOnInitXProperties = 5; kResetEventID = 3; kObjXPropAcceptsMarkers = 10; kObjXPropAcceptsNoneMarkers = 0; kObjXPropAcceptsBeginningOnlyMarkers = 1; kObjXPropAcceptsEndOnlyMarkers = 2; kObjXPropAcceptsBothMarkers = 3; kCR = Chr(13); VAR theEvent, theButton :LONGINT; result :BOOLEAN; objHand, recHand, wallHand, pathHand, dupeHand :HANDLE; objName :STRING; gArrowIndex :LONGINT; gMarkerSize :REAL; gMarkerAng :INTEGER; begArr, endArr :BOOLEAN; width :REAL; thickBasis :INTEGER; thickness :REAL; visibility :BOOLEAN; ok :BOOLEAN; BEGIN vsoGetEventInfo(theEvent, theButton); CASE theEvent OF {User has single-clicked the object's icon.} {L'utilisateur a cliqué une fois sur l'icône de l'objet.} kObjOnInitXProperties: BEGIN {This allows the object to accept marker setting from the Attributes palette.} {Cela permet à l'objet d'accepter le réglage du marqueur de la palette Attributs.} result := SetObjPropCharVS(kObjXPropAcceptsMarkers, Chr(kObjXPropAcceptsBothMarkers)); END;{ kObjOnInitXProperties } {Object reset has been called.} { Object reset – redraw everything } { Réinitialisation de l'objet - tout redessiner } kResetEventID: BEGIN IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN BEGIN pathHand := GetCustomObjectPath(objHand); dupeHand := CreateDuplicateObject(pathHand, objHand); {Get the settings from objHand and apply them to dupeHand.} {Obtenez les paramètres de objHand et appliquez-les à dupeHand.} {Note that Get/SetObjArrow are obsolete in 2008.} {Use Get/SetObjBeginningMarker and Get/SetObjEndMarker in 2008 or above.} { GetObjArrow(objHand, gArrowIndex, gMarkerSize, gMarkerAng, begArr, endArr); } { GetObjBeginningMarker (h, style, angle, size, width, thickBasis, thickness, visibility); } ok := GetObjBeginningMarker(objHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); AlrtDialog(Concat('gArrowIndex : ', gArrowIndex, kCR, 'gMarkerAng : ', gMarkerAng, kCR, 'gMarkerSize : ', gMarkerSize, kCR, 'width : ', width, kCR, 'thickBasis : ', thickBasis, kCR, 'thickness : ', thickness, kCR, 'visibility : ', visibility)); ok := SetObjBeginningMarker(dupeHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); ok := GetObjEndMarker(objHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); AlrtDialog(Concat('gArrowIndex : ', gArrowIndex, kCR, 'gMarkerAng : ', gMarkerAng, kCR, 'gMarkerSize : ', gMarkerSize, kCR, 'width : ', width, kCR, 'thickBasis : ', thickBasis, kCR, 'thickness : ', thickness, kCR, 'visibility : ', visibility)); ok := SetObjEndMarker(dupeHand, gArrowIndex, gMarkerAng, gMarkerSize, width, thickBasis, thickness, visibility); { SetObjArrow(dupeHand, gArrowIndex, gMarkerSize / GetPrefReal(152), gMarkerAng, begArr, endArr); } END;{ if } vsoStateClear(objHand); END;{ kResetEventID } END;{ case } END; RUN(Example081); Thank you in advance for your feedback and have a nice day, Thomas
  13. Thanks for the info Pat, I took you back a few decades to find the source! Well I was not fast enough but I don't think I will have made it my bedside book! Thanks and good day
  14. Thanks for your feedback and these details! I will continue my tests and my research, Thanks and have a nice day
  15. Hi there, @Pat Stanford I'm trying to understand how plugins work and have a question about your answer above. Where can we find the information which indicates for example that it is necessary to put a "p" in front of "ThisSymDef" and "TextData" in the script? The "p" tells the script to look in the settings tab of the plugin definition? I know these are basic questions but this information is important before you can understand more complicated posts like the ones below: How to make a PIO Styled? User:CBM-c-/Plug-in with widget basic example Thanks!
  16. Hello @MullinRJ, I took the 1st version of the script taking into account your remarks and adding the search for duplicate symbols in the background, it works well but we will use the version with the AlertQuestion function which will cancel each loop. Below is the 1st version with the YNDialog function: PROCEDURE SearchDuplicateWallAndSymbol; {$DEBUG} { Utiliser ce script dans la vue en plan 2d. } { Ce script va chercher des murs et des symboles qui ne seraient pas visibles en 2d et qui seraient cachés en étant sur des couches inférieures. } { Use this script in 2D Plan view. } { This script will look for walls and symbols which would not be visible in 2D and which would be hidden by being on lower layers. } CONST kWallType = 68; { type objet mur } { wall object type } kSymbolType = 15; { type objet symbol placé } { placed symbol object type } kCR = Chr(13); { retour à la ligne } { carriage control char } kSNameTemp = 'Tmp'; { nom temporaire } { temporary name } VAR Hd1, Hd2 :HANDLE; SWallStyleName, ActLName :STRING; SymbolName1, SymbolName2 :STRING; TL_A, BR_A, CenA :POINT; { BBox et points centraux pour A } { BBox & Center Points for A } { TL = TopLeft, BR = BottomRight, Cen = Center } InsPtS1, InsPtS2 :POINT; { Point d'insertion symbole 1 et 2 } { Symbol insertion point 1 and 2 } { InsPt = point d'insertion du Symbole } { InsPt = Symbol insertion point } PROCEDURE CompareNextObjectWall(Hd2:HANDLE); { recherche un mur avec la même boite englobante et le même centre. } { searches for a wall with the same bounding box and the same center. } VAR TL_B, BR_B, CenB :POINT; { BBox et points centraux pour B } { BBox & Center Points for B } { TL = TopLeft, BR = BottomRight, Cen = Center } BEGIN GetBBox(Hd2, TL_B.x, TL_B.y, BR_B.x, BR_B.y); HCenter(Hd2, CenB.x, CenB.y); IF (TL_B = TL_A) & (BR_B = BR_A) & (CenB = CenA) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects', 0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); { Do you want to delete this Duplicate whose wall style is: } IF YNDialog(Concat('Voulez-vous supprimer ce Doublon dont le style de mur est :', kCR, SWallStyleName)) THEN DelObject(Hd2) ELSE SetDSelect(Hd2); END; { if BBox et points centraux de B = BBox et points centraux de A } { if BBox & Cen are equal } END; { CompareNextObjectWall } PROCEDURE CompareHiddenWall(Hd2:HANDLE); { recherche un mur qui serait caché dans l'alignement d'un autre mur sans avoir forcément la même taille. } { searches for a wall that would be hidden in line with another wall without necessarily having the same size. } VAR CenB :POINT; { points centraux pour B } { Center Points for B } BEGIN HCenter(Hd2, CenB.x, CenB.y); IF (((CenB.x = CenA.x) & (CenB.y <= TL_A.y) & (CenB.y >= BR_A.y)) | ((CenB.y = CenA.y) & (CenB.x >= TL_A.x) & (CenB.x <= BR_A.x))) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); { Do you want to delete this Hidden Wall whose wall style is: } IF YNDialog(Concat('Voulez-vous supprimer ce Mur Caché dont le style de mur est :', kCR, SWallStyleName)) THEN DelObject(Hd2) ELSE SetDSelect(Hd2); END; { if mur caché dans l'alignement } { if wall hidden in line with another wall } END; { CompareHiddenWall } PROCEDURE CompareDuplicateSymbol(Hd2:HANDLE); { recherche un symbole qui aurait le même point d'insertion et qui serait à l'arrière plan } { searches for a symbol that would have the same insertion point and that would be in the background } BEGIN GetSymLoc(Hd2, InsPtS2.x, InsPtS2.y); SymbolName2 := GetSymName(Hd2); IF (SymbolName2 = SymbolName1) & (InsPtS2 = InsPtS1) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); { Do you want to delete this Duplicate Symbol whose name is: } IF YNDialog(Concat('Voulez-vous supprimer ce Doublon de Symbole dont le nom est: ', kCR, SymbolName2)) THEN DelObject(Hd2) ELSE SetDSelect(Hd2); END; { if symbole qui aurait le même point d'insertion } END; { CompareDuplicateSymbol } BEGIN DSelectAll; Hd1 := LActLayer; ActLName := GetLName(ActLayer); WHILE (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kWallType) THEN BEGIN GetBBox(Hd1, TL_A.x, TL_A.y, BR_A.x, BR_A.y); HCenter(Hd1, CenA.x, CenA.y); DelName(kSNameTemp); SetName(Hd1, kSNameTemp); ForEachObject(CompareNextObjectWall, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=WALL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } AlrtDialog('Il n''y a pas ou plus de "Doublon" de mur en arrière plan'); { There is no or no more "Duplicate" wall in the background } Hd1 := LActLayer; WHILE (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kWallType) THEN BEGIN GetBBox(Hd1, TL_A.x, TL_A.y, BR_A.x, BR_A.y); HCenter(Hd1, CenA.x, CenA.y); DelName(kSNameTemp); SetName(Hd1, kSNameTemp); ForEachObject(CompareHiddenWall, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=WALL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } AlrtDialog('Il n''y a pas ou plus de Murs cachés en arrière plan'); { There are no or no more hidden walls in the background } Hd1 := LActLayer; WHILE (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kSymbolType) THEN BEGIN GetSymLoc(Hd1, InsPtS1.x, InsPtS1.y); SymbolName1 := GetSymName(Hd1); DelName(kSNameTemp); SetName(Hd1,kSNameTemp); ForEachObject(CompareDuplicateSymbol, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=SYMBOL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } AlrtDialog('Il n''y a pas ou plus de Symboles dupliqués en arrière plan'); { There are no or no more duplicate Symbols in the background } END; Run(SearchDuplicateWallAndSymbol); And the version with the AlertQuestion function: PROCEDURE SearchDuplicateWallAndSymbol; {$DEBUG} { Utiliser ce script dans la vue en plan 2d. } { Ce script va chercher des murs et des symboles qui ne seraient pas visibles en 2d et qui seraient cachés en étant sur des couches inférieures. } { Use this script in 2D Plan view. } { This script will look for walls and symbols which would not be visible in 2D and which would be hidden by being on lower layers. } CONST kWallType = 68; { type objet mur } { wall object type } kSymbolType = 15; { type objet symbol placé } { placed symbol object type } kCR = Chr(13); { retour à la ligne } { carriage control char } kSNameTemp = 'Tmp'; { nom temporaire } { temporary name } VAR Hd1, Hd2 :HANDLE; Done :BOOLEAN; { utilisé dans le choix de AlertQuestion et dans les boucle While } { used in AlertQuestion choice and while loops } SWallStyleName, ActLName :STRING; SymbolName1, SymbolName2 :STRING; TL_A, BR_A, CenA :POINT; { BBox et points centraux pour A } { BBox & Center Points for A } { TL = TopLeft, BR = BottomRight, Cen = Center } InsPtS1, InsPtS2 :POINT; { Point d'insertion symbole 1 et 2 } { Symbol insertion point 1 and 2 } { InsPt = point d'insertion du Symbole } { InsPt = Symbol insertion point } PROCEDURE CompareNextObjectWall(Hd2:HANDLE); { recherche un mur avec la même boite englobante et le même centre. } { searches for a wall with the same bounding box and the same center. } VAR Choice :INTEGER; { choix pour la fonction AlertQuestion } { choice for the AlertQuestion function } Question :STRING; { Question utilisée dans la fonction AlertQuestion } { Question used in the AlertQuestion function } TL_B, BR_B, CenB :POINT; { BBox et points centraux pour B } { BBox & Center Points for B } { TL = TopLeft, BR = BottomRight, Cen = Center } BEGIN GetBBox(Hd2, TL_B.x, TL_B.y, BR_B.x, BR_B.y); HCenter(Hd2, CenB.x, CenB.y); IF (TL_B = TL_A) & (BR_B = BR_A) & (CenB = CenA) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects', 0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); { Do you want to delete this Duplicate whose wall style is: } Question := Concat('Voulez-vous supprimer ce Doublon dont le style de mur est :', kCR, SWallStyleName); Choice := AlertQuestion(Question, '', 1, 'Delete', 'Cancel', 'Skip', ''); { AlertQuestion(question, advice, defaultButton, OKOverrideText, CancelOverrideText, customButtonAText, customButtonBText) } CASE Choice OF 1: DelObject(Hd2); { Delete : 1: the positive button was hit } 2: SetDSelect(Hd2); { Skip : 2: custom button A was hit } 0: Done := TRUE; { Quit : 0: the negative button was hit } END; END; { if (BBox et points centraux de B) = (BBox et points centraux de A) } { if BBox & Cen are equal } END; { CompareNextObjectWall } PROCEDURE CompareHiddenWall(Hd2:HANDLE); { recherche un mur qui serait caché dans l'alignement d'un autre mur sans avoir forcément la même taille. } { searches for a wall that would be hidden in line with another wall without necessarily having the same size. } VAR Choice :INTEGER; { choix pour la fonction AlertQuestion } { choice for the AlertQuestion function } Question :STRING; { Question utilisée dans la fonction AlertQuestion } { Question used in the AlertQuestion function } CenB :POINT; { points centraux pour B } { Center Points for B } BEGIN HCenter(Hd2, CenB.x, CenB.y); IF (((CenB.x = CenA.x) & (CenB.y <= TL_A.y) & (CenB.y >= BR_A.y)) | ((CenB.y = CenA.y) & (CenB.x >= TL_A.x) & (CenB.x <= BR_A.x))) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); { Do you want to delete this Hidden Wall whose wall style is: } Question := Concat('Voulez-vous supprimer ce Mur Caché dont le style de mur est :', kCR, SWallStyleName); Choice := AlertQuestion(Question, '', 1, 'Delete', 'Cancel', 'Skip', ''); { AlertQuestion(question, advice, defaultButton, OKOverrideText, CancelOverrideText, customButtonAText, customButtonBText) } CASE Choice OF 1: DelObject(Hd2); { Delete : 1: the positive button was hit } 2: SetDSelect(Hd2); { Skip : 2: custom button A was hit } 0: Done := TRUE; { Quit : 0: the negative button was hit } END; END; { if mur caché dans l'alignement } { if wall hidden in line with another wall } END; { CompareHiddenWall } PROCEDURE CompareDuplicateSymbol(Hd2:HANDLE); { recherche un symbole qui aurait le même point d'insertion et qui serait à l'arrière plan } { searches for a symbol that would have the same insertion point and that would be in the background } VAR Choice :INTEGER; { choix pour la fonction AlertQuestion } { choice for the AlertQuestion function } Question :STRING; { Question utilisée dans la fonction AlertQuestion } { Question used in the AlertQuestion function } BEGIN GetSymLoc(Hd2, InsPtS2.x, InsPtS2.y); SymbolName2 := GetSymName(Hd2); IF (SymbolName2 = SymbolName1) & (InsPtS2 = InsPtS1) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); { Do you want to delete this Duplicate Symbol whose name is: } Question := Concat('Voulez-vous supprimer ce Doublon de Symbole dont le nom est: ', kCR, SymbolName2); Choice := AlertQuestion(Question, '', 1, 'Delete', 'Cancel', 'Skip', ''); { AlertQuestion(question, advice, defaultButton, OKOverrideText, CancelOverrideText, customButtonAText, customButtonBText) } CASE Choice OF 1: DelObject(Hd2); { Delete : 1: the positive button was hit } 2: SetDSelect(Hd2); { Skip : 2: custom button A was hit } 0: Done := TRUE; { Quit : 0: the negative button was hit } END; END; { if symbole qui aurait le même point d'insertion } { symbol that would have the same insertion point } END; { CompareDuplicateSymbol } BEGIN DSelectAll; Hd1 := LActLayer; ActLName := GetLName(ActLayer); Done := FALSE; WHILE NOT Done & (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kWallType) THEN BEGIN GetBBox(Hd1, TL_A.x, TL_A.y, BR_A.x, BR_A.y); HCenter(Hd1, CenA.x, CenA.y); DelName(kSNameTemp); SetName(Hd1, kSNameTemp); ForEachObject(CompareNextObjectWall, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=WALL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } IF NOT Done THEN AlrtDialog('Il n''y a pas ou plus de "Doublon" de mur en arrière plan'); { There is no or no more "Duplicate" wall in the background } Hd1 := LActLayer; Done := FALSE; WHILE NOT Done & (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kWallType) THEN BEGIN GetBBox(Hd1, TL_A.x, TL_A.y, BR_A.x, BR_A.y); HCenter(Hd1, CenA.x, CenA.y); DelName(kSNameTemp); SetName(Hd1, kSNameTemp); ForEachObject(CompareHiddenWall, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=WALL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } IF NOT Done THEN AlrtDialog('Il n''y a pas ou plus de Murs cachés en arrière plan'); { There are no or no more hidden walls in the background } Hd1 := LActLayer; Done := FALSE; WHILE NOT Done & (Hd1 <> NIL) DO BEGIN IF (GetTypeN(Hd1) = kSymbolType) THEN BEGIN GetSymLoc(Hd1, InsPtS1.x, InsPtS1.y); SymbolName1 := GetSymName(Hd1); DelName(kSNameTemp); SetName(Hd1,kSNameTemp); ForEachObject(CompareDuplicateSymbol, (NOTINDLVP & NOTINREFDLVP & ((L=ActLName) & (T=SYMBOL) & (N<>kSNameTemp)))); DelName(kSNameTemp); END; { if } Hd1 := PrevObj(Hd1); END; { while } IF NOT Done THEN AlrtDialog('Il n''y a pas ou plus de Symboles dupliqués en arrière plan'); { There are no or no more duplicate Symbols in the background } END; Run(SearchDuplicateWallAndSymbol); Thank you again for the advice and help that allowed me to move forward on this script! Thanks! Thomas
  17. @MullinRJ, Excellent! That's what I was looking for, I'll test this AlertQuestion function and I'll post the script, but I'll first retest the boolean conditions to consolidate two subroutines into one. Sorry for the late reply, I was on the weekend! Thank you again for this information and have a nice day, Thomas
  18. Hello @MullinRJ, Thank you very much for these remarks and suggestions for improvements, it helps me to see logic and reasoning that I would have had trouble seeing on my own. I will rewrite these two versions taking into account your remarks (and adding the duplicate symbol search in the background). I will add more comments which will be useful especially when not writing scripts regularly! Thank you again for taking the time for this answer and have a nice day, Thomas
  19. Hi, I'm not sure I fully understand the problem but I think it's possible for data labels with some precautions: On the screenshot below the 7 data labels are in the General class which has a blue tint, but only 4 are blue because if you edit the formatting of the label you can have other classes which they are black for example, hope this is a good lead?
  20. The function DoMenuTextByName('Fit To Objects',0) worked fine for me even though I couldn't find it in the help (but on this forum)! Thanks for your feedback, Thomas
  21. Hi all, I made a script to find and remove duplicate and/or hidden walls in the background but I would like your opinion on the way it's written and on possible improvements. Compared to Vector's function which is in File/File Contents/Show/Duplicate Objects: - I wanted to be able to locate the object before deleting it - also select the hidden walls in the background which are at the same position but which can have another wall style - select the walls in the back plan which are hidden and shifted. Small explanations: The goal is to avoid costing errors, we use pieces of walls to make wall panel then we recover them in a worksheet, we use different models that we move or copy so these errors can happen. In the script there are 2 loops While (Hd1<>NIL) DO to separate the 2 dialog boxes between the superimposed walls and those which are shifted. Is it possible to add a function that should escape and stop the running script? With the IF NOT DidCancel function, you have to add a dialog in addition to YNDialog but is it possible without this dialog? I hope my explanations are clear enough and I would appreciate your remarks to improve this script. Below is the script and an attached file for tester. Thanks, PROCEDURE SearchDuplicateWall; {Utiliser ce script dans la vue en plan 2d} {ce script va chercher des murs qui ne seraient pas visibles en 2d et qui seraient cachés en étant sur des couches inférieures} CONST kIndex=68; {type objet mur} VAR Hd1, Hd2 :HANDLE; A1x,A1y,A2x,A2y :REAL; {Coordonnée en haut à gauche et en bas à droite de la boîte englobante A} CAx,CAy : REAL; {Centre de la boîte englobante A} B1x,B1y,B2x,B2y :REAL; {idem pour B} CBx,CBy :REAL; {idem pour B} SNameTemp, SWallStyleName : STRING; PROCEDURE CompareNextObjectWall(Hd2 :HANDLE); {recherche un mur avec la même boite englobante et le même centre} BEGIN GetBBox(Hd2,B1x,B1y,B2x,B2y); HCenter(Hd2,CBx,CBy); IF(((A1x=B1x) AND (A1y=B1y) AND (A2x=B2x) AND (A2y=B2y)) AND ((CAx=CBx) AND (CAy=CBy))) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); IF YNDialog(Concat('Voulez-vous supprimer ce Doublon dont le style de mur est :',CHR(13),SWallStyleName))=TRUE THEN BEGIN DelObject(Hd2); END ELSE SetDSelect(Hd2); END; END; PROCEDURE CompareHiddenWall(Hd2 :HANDLE); {recherche un mur qui serait caché dans l'alignement d'un autre mur sans avoir forcément la même taille} BEGIN GetBBox(Hd2,B1x,B1y,B2x,B2y); HCenter(Hd2,CBx,CBy); IF (((CBx=CAx) AND (CBy<=A1y) AND (CBy>=A2y)) OR ((CBy=CAy) AND (CBx>=A1x) AND (CBx<=A2x))) THEN BEGIN SetSelect(Hd2); DoMenuTextByName('Fit To Objects',0); SetZoom(100); SWallStyleName := GetWallStyle(Hd2); IF YNDialog(Concat('Voulez-vous supprimer ce Mur Caché dont le style de mur est :',CHR(13),SWallStyleName))=TRUE THEN BEGIN DelObject(Hd2); END ELSE SetDSelect(Hd2); END; END; BEGIN DSelectAll; Hd1:=LActLayer; SNameTemp := 'Tmp'; WHILE (Hd1<>NIL) DO BEGIN IF (GetTypeN(Hd1)=kIndex) THEN BEGIN GetBBox(Hd1,A1x,A1y,A2x,A2y); HCenter(Hd1,CAx,CAy); DelName('Tmp'); SetName(Hd1, 'Tmp'); ForEachObject(CompareNextObjectWall, (NOTINDLVP & NOTINREFDLVP & ((L='Dessin') & (T=WALL) & (N<>'Tmp')))); DelName('Tmp'); Hd1:=PrevObj(Hd1); END ELSE Hd1:=PrevObj(Hd1); END; AlrtDialog('Il n''y a pas ou plus de "Doublon" de mur en arrière plan'); Hd1:=LActLayer; WHILE (Hd1<>NIL) DO BEGIN IF (GetTypeN(Hd1)=kIndex) THEN BEGIN GetBBox(Hd1,A1x,A1y,A2x,A2y); HCenter(Hd1,CAx,CAy); DelName('Tmp'); SetName(Hd1, 'Tmp'); ForEachObject(CompareHiddenWall, (NOTINDLVP & NOTINREFDLVP & ((L='Dessin') & (T=WALL) & (N<>'Tmp')))); DelName('Tmp'); Hd1:=PrevObj(Hd1); END ELSE Hd1:=PrevObj(Hd1); END; AlrtDialog('Il n''y a pas ou plus de Murs cachés en arrière plan'); END; Run(SearchDuplicateWall); TW VScript recherche doublon de murs-V4 FINAL - Forum.vwx
  22. Bonjour Pat, Je n'ai pas vu de différence entre le site du développeur et l'aide local mais la fonction 'Fit To Objects' n'est pas présente, seul la fonction 'Fit to Window' est présente. Merci et bonne journée
  23. Hi all, Should all functions available for DoMenuTextByName be available in the online and/or local version of VS:Function Reference Appendix H or am I missing something? I found the function 'Fit To Objects' on the forum but not in the help, is it an oversight in the help or is there other places where these functions are available? I'm working on a French version. Thank you and good day, Thomas
  24. Hello Pat and thank you for your answer, ForEachObjectInList shouldn't return a NIL handle, that's ok. For the IF I'm not sure I can do without it in this case, in any case I wouldn't know how. If I don't put an IF CheckedSymbols<=NumItems1 condition I get an Error on line=20: EXECUTE CHECKEDSYMBOLS - Index outside array limits because of CheckedSymbols:= CheckedSymbols+1. Thanks and have a good day, Bonjour Pat et merci pour ta réponse, ForEachObjectInList ne devrait pas renvoyer de handle NIL, ça c'est ok. Pour le IF je ne suis pas sûr de pouvoir m'en passer dans ce cas, en tous cas je ne saurais pas comment. Si je ne mets pas de condition IF CheckedSymbols<=NumItems1 j'ai une Error on line=20: EXECUTE CHECKEDSYMBOLS - Index outside array limits à cause de CheckedSymbols:= CheckedSymbols+1. Bonne journée,
×
×
  • Create New...