Graph text distance tweak

Hans Lammerts
edited December 2019 in 2D Drafting

Hi there! i want to use my onscreen distance tool but somehow i can't load LM:Grtext function in BricsCAD.
I tried a few things but could not get ik to work for BricsCAD. Would like it.
You can find the lisp underneath as comment in YouTube.

https://www.youtube.com/watch?v=XZ8P4zIg9jM

Thanks!

Comments

  • @Hans Lammerts
    The youtube comment is private it seems, can you just post code here?

  • Here is the code as attachment.
    Resource from Mr. Lee Mac here
    http://www.lee-mac.com/grtext.html

  • ok, the code I find loads fine. You need to get the code into one file as your cadtutor post is not clear.

  • ok.
    In 2Dwireframe it should return the grdraw fundtion on screen and not this messagebox.
    The messagebox is meant for 3D conceptual

    (setq alertmode (getvar "vsfacestyle"))
    (if (= alertmode 0) ; depending on vsfacestyle 0 = 2D wireframe

    BricsCAD gives this
    Unable to recognize command "VSFACESTYLE". This error can occur when the command is not supported for the active license.

    I will need a other variable to determine if i'm working 2d wireframe or in 3D. Any suggestions?

  • Yah, that var is not in bcad and was tripping up another macro of mine too.
    Do you really mean you need to know if the view is twisted in 3d?
    You can have a visual style of anything in any view twist, so seems like a bad var to test.
    I think I typically compare the current view vector to UCS normal vector to see if the two are in same dir.

  • The reason to display an alertmessage in other visualstyles other than 2Dwireframe is because LM:Grtext has some display issue
    I want a variable to determine which visual style is active. A difference between "2Dwireframe" versus "conceptual" being active
    In AutoCAD i used vsfacestyle but i need something else because this is not availabel. I did not found a good one yet. Thought about background color in combination with a 2D/3D switch i use. The background color should change to white is my flavor.
    I posted the code sofar. Thanks for your time!

    dii.lsp 25.1K
  • I found this code that gets the 348 group of the viewport:
    ((lambda ()
    (vl-load-com)
    (vl-catch-all-error-message
    (vl-catch-all-apply '(lambda()
    (setq vp (vla-get-activeviewport
    (vla-get-activedocument (vlax-get-acad-object)))
    vp (vlax-vla-object->ename vp)
    elist (entget vp)
    vs (cdr (assoc 348 elist))
    vlist (entget vs)
    vstyle (cdr (assoc 2 vlist)))
    (alert vstyle))))))

    That is working for me on the modelspace viewport, at least.

  • I'm not a kind of very patient coder.
    This is what i would expect to work with your lambda vstyle call.
    But it fails at loading allready.

    ; error : bad argument type <"2dWireframe"> ; expected VL-CATCH-ALL-APPLY-ERROR at [vl-catch-all-error-message]

    (if (= vstyle "2Dwireframe")
    (LM:DisplayGrText_2d
    p2
    (LM:GrText (strcat alertstring))
    stringcolor
    txtxoff
    txtyoff
    ) ; only 2D with GRtext
    (alert alertstring) ; else put it in a message
    )
    )