Author Topic: How to display an end point  (Read 6630 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to display an end point
« Reply #30 on: January 20, 2018, 10:01:27 AM »
I have modified the ShowSE code so that it also works for BricsCAD. The code includes a modified version of Lee's LM:grx function. See my post here.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: How to display an end point
« Reply #31 on: January 20, 2018, 11:29:50 AM »
Thanks Roy - in AutoCAD (ssadd ent (ssadd)) can be (ssadd ent) - this will return a new selset containing only ent.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to display an end point
« Reply #32 on: January 21, 2018, 05:42:22 AM »
Thanks Roy - in AutoCAD (ssadd ent (ssadd)) can be (ssadd ent) - this will return a new selset containing only ent.
Your suggestion also works in BricsCAD.

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #33 on: January 21, 2018, 04:27:09 PM »
I like to put in the LM:GRX cross if Z is not 0.0. Very Useful for functional display and give user a hint there might be something wrong in the value (2D speaking). Checking for polyline join. Wish this turn into =>  entget / foreach for a selection.
To be nice to be able to display a complete selection this way.

If user decides to pass only 1 element then finish with statement (sssetfirst nil (ssadd ent (ssadd)))

Here is my code sofar, i'm going to dive in my archive for some good eaxples for a foreach statements ;-)

Dubb, hope you do't mind ..

Code: [Select]

(defun c:showSE (/ ent enx ptS ptE ptSz ptEz)

  ; (load "GrTextV1-1.lsp") ; Code needed : Lee Mac
  ; KGA_Geom_MatrixMake and LM:grx_BC for BricsCAD by Roy Klein Gebbinck

  ;; Display GrText  -  Lee Mac
  ;; pnt  -  cursor point in UCS
  ;; vec  -  GrText vector list
  ;; col  -  Text Colour (ACI Colour)
  ;; xof  -  x-offset from cursor in pixels
  ;; yof  -  y-offset from cursor in pixels


  (if (and
(setq ent (car (entsel "\nSelect a (poly)line: ")))
(member (cdr (assoc 0 (setq enx (entget ent))))
'("LWPOLYLINE" "LINE" "ARC" "SPLINE" "POLYLINE")
)
(not (vlax-curve-isClosed ent)) ; so it will be an open curve
      )
    (progn
      (setq ptS (vlax-curve-getStartPoint ent))
      (setq ptE (vlax-curve-getEndPoint ent))
      (setq ptSz (caddr ptS))
      (setq ptEz (caddr ptE))
      (if (= ptSz 0)
()
(if (= "BRICSCAD" (strcase (getvar 'product)))
  (progn
    (LM:grx_BC ptS 10 3)
  )
  (progn
    (LM:grx ptS 10 3)
  )
)
      )
      (if (= ptEz 0)
()
(if (= "BRICSCAD" (strcase (getvar 'product)))
  (progn
    (LM:grx_BC ptE 10 1)
  )
  (progn
    (LM:grx ptE 10 1)
  )
)
      )
      (LM:DisplayGrText ptS (LM:GrText (strcat "S")) 3 10 -25)
      (LM:DisplayGrText ptE (LM:GrText (strcat "E")) 1 10 -25)
      (setq ptS nil)
      (setq ptE nil)
      (setq ptSz nil)
      (setq ptEz nil)
      (sssetfirst nil (ssadd ent))
    )
  )
)
[\code]


« Last Edit: January 21, 2018, 04:31:20 PM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #34 on: January 23, 2018, 02:26:45 AM »
For a selection of elements i made this work.

Code: [Select]

(defun c:showSE (/ ent enx ptS ptE ptSz ptEz)

  (load "GrTextV1-1.lsp") ; Lee Mac

  ;; Display GrText  -  Lee Mac
  ;; pnt  -  cursor point in UCS
  ;; vec  -  GrText vector list
  ;; col  -  Text Colour (ACI Colour)
  ;; xof  -  x-offset from cursor in pixels
  ;; yof  -  y-offset from cursor in pixel

  (setq ~CMD (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq curlay (getvar 'CLAYER))
  (setq ss1 (ssget))
  (setq count (sslength ss1)) ; to count amount of elements
  (setq number 0) ; use the number get to next
  (repeat count
    (progn
      (setq ent (ssname ss1 number)) ; selection per ent, get name of n-th element
      (setq number (1+ number)) ; add one for next volgende element na deze loop
; do ShowSE function for each entity
      (progn
(if (and
      (member (cdr (assoc 0 (setq enx (entget ent))))
      '("LWPOLYLINE" "LINE" "ARC" "SPLINE" "POLYLINE")
      )
      (not (vlax-curve-isClosed ent)) ; so it will be an open curve

    )
  (progn
    (setq ptS (vlax-curve-getStartPoint ent))
    (setq ptE (vlax-curve-getEndPoint ent))
    (setq ptSz (caddr ptS))
    (setq ptEz (caddr ptE))
    (if (= ptSz 0)
      ()
      (LM:grx ptS 10 3)
    )
    (if (= ptEz 0)
      ()
      (LM:grx ptE 10 1)
    )
    (LM:DisplayGrText ptS (LM:GrText (strcat "S")) 3 8 -8)
    (LM:DisplayGrText ptE (LM:GrText (strcat "E")) 1 8 -8)
    (setq ptS nil)
    (setq ptE nil)
    (setq ptSz nil)
    (setq ptEz nil)
  )
  ()
) ; end if
      ) ;end progn
    ) ;end progn
  ) ;end repeat   
  (setvar "CMDECHO" ~CMD)
)

Design is something you should do with both hands. My 2d hand , my 3d hand ..