Kubotek Forum

KeyCreator & KeyCreator Viewer Technical discussion of CAD/CAM and integrated partner products
Customer Forum > KeyCreator & KeyCreator Viewer > KXL: editing a note? View modes: 
User avatar
Advanced member
Advanced member
Dana - 11/4/2021 10:10:35 AM
   
KXL: editing a note?
Is there a way to edit the text of an existing note via KXL?  It seems there must be, but I sure can't find it.  It would be similar to SetDetailDimText, but that seems to only work on dimensions.  I suppose I can delete and recreate the note, but that's a kludgy hack.

User avatar
Advanced member
Advanced member
Hans_Winkler - 11/4/2021 7:03:50 PM
   
RE:KXL: editing a note?
Dana,
a few weeks ago I sent you a CDE. One of the functions will do what you want.
Here is what you will have to do in the KXL:

hEntNote // note handle name to pass to CDE
$sNoteToCDE // string variable to pass to the CDE (holds the new text)
CDEOpen "GetVarToKXL64.cde" // only needed if CDE is not loaded on startup
CDEExecute "ModNoteText" // call the CDE function ModNoteText
// text is now updated

As far as I know, deleting and recreating the note is the only way to do it in KXL.

That's why I wrote (with help from a friend) that CDE for short commings in the KXL language.

Hans

User avatar
Advanced member
Advanced member
Dana - 11/5/2021 9:40:13 AM
   
RE:KXL: editing a note?
Thanks Hans, that works!

I looked at teaching myself C++ so I could write CDEs a few years back (back in the "gadget utilities" days), got a shrink wrapped copy from a friend whose son worked at Microsoft.  Looked at the first few code examples and decided I had better things to do with my time. 

FWIW, this started because I wanted to link two notes (using the new |401 note field) in a drawing border together so I only have to change one and the other changes automatically.  I tried doing it in the border file, but when it's imported the entity IDs change, so I have to edit the target note after the border file is inserted, and I wanted to make that easier.

------------------------------------------------------------------------------------------

// changes the target note entity to be linked to the text of the sourceID
// requires Hans Winkler's GetVarToKXL64.cde
// DMH 211105

:start
clear hsource, hEntNote, sourceID, $NoteToCDE
MASKENTITY 9, 10, 11, 12, 13, 14, 15, 16
:select
GETENT "Select detail entity with target text:", hsource
ON (@key+3) GOTO done, done,
GETENT "Select detail entity to match to target:", hEntNote
on (@key+3) GOTO done, select,
MASKCLEAR
GetIDFromEnt hsource, sourceID
SPrint $sNoteToCDE, "|401%i|401", sourceID
CDEOpen "GetVarToKXL64.cde"
CDEExecute "ModNoteText"
CallFunc (0xA1CA)
NoteState
GOTO start
:done
clear hsource, hEntNote, sourceID, $NoteToCDE


User avatar
Advanced member
Advanced member
Hans_Winkler - 11/5/2021 6:01:58 PM
   
RE:KXL: editing a note?
Dana,
I hear you when it comes to C++. Not my style either. I know the bare minimum. I pretty much use it to try to write code, when KXL fails.

1
Login