problem with command ddedit when called from Lisp

When called from Lisp the command ddedit with the internal editor (mtexted is set to ".")  behaves weird when the editor is closed with a click on the "OK" button. The command repeatedly asks to select other objects or fires error messages, but in Lisp the (command "") seems not to be recognized.

For a test store the ename of an mtext entity in a variable:
(setq men (car (entsel)))

Then try (command "._ddedit" men). You can edit the Mtext, but after clicking on OK the command asks for another object.

Try (command "._ddedit" men "") instead. You will get an error message that a point is required.

Try (progn (command "._ddedit" men))  (while (eq 1 (logand 1 (getvar "cmdactive"))) (command pause))) and you will receive the same error message.

In AutoCAD (command "._mtedit" men) does the job OK. Using Notepad (mtexted is set to "notepad") as editor works fine in BricsCAD too.

 

Comments

  • > Try (command "._ddedit" men "") instead. You will get an error message that a point is required.

    I get the following message: error : Function cancelled.

    In my lisp programs, I modify text objects directly with entget / entmod.

  • > In my lisp programs, I modify text objects directly with entget / entmod.

    In my Lisp apps I do this too. However, here I have a function where the *user* of my application needs to edit a Mtext object.

    Let me explain what I am doing: my app uses a MText string as a pattern for MText objects, i.e. the string "area: $area$" is used as a pattern, where "$area$ is a placeholder for a value that comes from my app. My app creates MText objects that look like "area: 51", where the 51 replaces the "$area$" in the pattern string.

    I let my users format that pattern string according to their needs, and for doing so I temporarily create a MText object that shows the pattern itself and then my app starts DDEDIT (or MTEDIT in AutoCAD). The user can then modify the pattern and use other fonts, modify text heigt and color, insert line breaks etc. After the users clicked OK in the MText editor, my app reads the modified text content from that edited MText object, stores it as a pattern for future use, and deletes the temporarily created pattern-mtext.

    So I depend on a way to enable my user to edit the pattern. Because of the weird behaviour of DDEDIT I need to use notepad in BricsCAD, but of course this is not as nice as the internal editor, since notepad doesn't offer "what you see is what you get" for the pattern layout.

     

  • It's only an idea: maybe you can realize the pattern edit options with dcl. This is a considerable expenditure, but if there is no other way...

  • > It's only an idea: maybe you can realize the pattern edit options with dcl.

    I have a dcl dialog to let the user modify the app settings and there he also can modify this pattern string. But of course here it's the same problem as with notepad: the user must know the control strings like "\P" or "\C001", and he can't directly see what he gets.

    It's the DDEDIT command that does not behave like it should, and that therefore is not usable in Lisp. That's a bug.

This discussion has been closed.