Recent Posts

Pages: [1] 2 3 ... 10
1
BricsCAD Users / Block Selection from MS Office and Insert into DWG File
« Last post by CEHill on Today at 06:09:02 PM »
Your thoughts and experiences on the subject line topic are appreciated.

Provide the overall level of difficulty, your preferred programming language, and the amount of coding needed to select and insert a drawing file from a link to that file from within in a MS Office application such as MS Excel or, ideally from our management's viewpoint, MS OneNote.

Are there more efficient means such as basing this development on another MS Office product or similar software up to and including a commercially available alternative over any custom-coded development.

From the local village: Due to complications of our cloud-based file storage, I have been told developing a database as in MS Access is not an alternative.

I have no experience in these types of development. Currently, I have beginner level coding skills but am familiar with program logic and willing to learn. 

Thanks,

Clint Hill 
2
XDRX-API / [XDrX-PlugIn(158)] Draw slope lines
« Last post by xdcad on Today at 03:48:40 PM »
1.https://www.cadtutor.net/forum/topic/84274-lisp-for-slope-lines/

2.https://www.cadtutor.net/forum/topic/19901-draw-slope-lines

Code: [Select]
(defun c:xdtb_slopeline (/ an anbase arc1 bEnd c_pt cir1 cir2 e e1 e2 ept ept1 ept2
       even-list even-pair g int1 ints lastent lastents lst m midp
       mLn1 mLn2 mLn3 mode n_pt nearpt1 nearpt2 odd-list p1 p2 pnt
       pt r1 r2 spt1 spt2 ss temp temp1 top-pts1 vec1 vec2 x
    )
  (defun _get-perp-point (crv pnt)
    (mapcar
      '+
      pnt
      (xdrx-vector-perpvector (xdrx-curve-getfirstderiv e1 pnt))
    )
  )
  (defun _get-point (e pt / p1)
    (setq p1 (_get-perp-point e pt))
    (if (setq ints (xdrx-entity-intersectwith (list pt p1) e2 1))
      (car ints)
    )
  )
  (defun _get-next-circle-inters ()
    (if (and
  (setq n_pt (cadr (member c_pt even-list)))
  (setq int1 (_get-point e1 n_pt))
)
      (progn
(setq r2 (distance n_pt int1)
      cir2 (xdrx-circle-make int1 r2)
)
(setq lastents (cons cir2 lastents))
(setq ints (xdrx-entity-intersectwith cir1 cir2))
(setq nearpt2 (xdrx-points-nearpt c_pt ints))
      )
      (progn
(setq bEnd t
      m (xdrx-matrix-setmirror (list c_pt midp))
      nearpt2 (xdrx-point-transform nearpt1 m)

)
      )
    )
  )
  (defun _get-appropriate-angle ()
    (setq vec1 (mapcar
'-
nearpt1
midp
       )
  vec2 (mapcar
'-
nearpt2
midp
       )
    )
    (setq anbase (angle midp c_pt)
  an (xdrx-vector-angle vec2 vec1)
    )
    (if (> an #xd-var-global-slope-Angle)
      (progn
(setq p1 (polar midp (+ anbase (/ #xd-var-global-slope-Angle 2.0))
(distance midp c_pt)
)
      temp1 (xdrx-entity-intersectwith (list midp p1) cir1 1)
      nearpt1 (xdrx-points-nearpt p1 temp1)
)
(if (not bEnd)
  (progn
    (setq p2 (polar midp (- anbase (/ #xd-var-global-slope-Angle 2.0))
    (distance midp c_pt)
     )
  temp1 (xdrx-entity-intersectwith (list midp p2) cir1 1)
  nearpt2 (xdrx-points-nearpt p2 temp1)
    )
  )
  (setq nearpt2 (xdrx-point-transform nearpt1 m))
)
      )
    )
  )
  (defun _draw-slope-line ()
    (setq g (xdrx-curve-setinterval cir1 nearpt1 nearpt2))
    (setq arc1 (xdrx-entity-make g))
    (setq mLn1 (xdrx-line-make temp midp)
  mLn2 (xdrx-line-make
midp
(xdrx-curve-getstartpoint arc1)
       )
  mLn3 (xdrx-line-make
(xdrx-curve-getendpoint arc1)
midp
       )
    )
    (xdrx-curve-join (list mLn1 mLn2 arc1 mLn3))
    (if (= #xd-var-global-slope-mode "1")
      (progn
(xdrx-polyline-setbulgeat
  (entlast)
  1
  #xd-var-global-bulge
)
(xdrx-polyline-setbulgeat
  (entlast)
  3
  #xd-var-global-bulge
)
      )
    )
  )
  (defun _draw-slope-1 ()
    (xdrx-line-make (car top-pts1) (xdrx-curve-getstartpoint e2))
    (setq lastent (entlast)
  lastents (cons lastent lastents)
  bEnd nil
    )
    (mapcar
      '(lambda (x)
(setq c_pt x)
(if (setq int1 (_get-point e1 c_pt))
   (progn
     (setq temp int1
   midp (xdrx-line-midp c_pt temp)
     )
     (setq r1 (distance c_pt int1)
   cir1 (xdrx-circle-make int1 r1)
     )
     (setq lastents (cons cir1 lastents))
     (if (setq ints (xdrx-entity-intersectwith cir1 lastent))
       (progn
(setq nearpt1 (xdrx-points-nearpt c_pt ints))
(setq nearpt2 (_get-next-circle-inters))
(_get-appropriate-angle)
(_draw-slope-line)
(xdrx-entity-delete cir2)
(setq lastent cir1)
       )
     )
   )
)
       )
      even-list
    )
    (xdrx-entity-delete lastents)   
  )
  (defun _draw-short-slope-line (lst)
    (mapcar
      '(lambda (x)
(setq p1 (_get-perp-point e1 x))
(if (setq ints (xdrx-entity-intersectwith (list x p1) e2 1))
   (progn
     (xdrx-line-make x (xdrx-line-midp x (car ints)))
   )
)
       )
      lst
    )
  )
  (defun _draw-slope-0 ()
    (xdrx-line-make (car top-pts1) (xdrx-curve-getstartpoint e2))
    (mapcar
      '(lambda (x)
(setq p1 (_get-perp-point e1 x))
(if (setq ints (xdrx-entity-intersectwith (list x p1) e2 1))
   (progn
     (xdrx-line-make x (car ints))
     (setq ept x)
   )
)
       )
      (cdr odd-list)
    )
    (_draw-short-slope-line even-list)
  )        ; main
  (setq #xd-var-global-bulge -0.2      ;  BULGE values of arc segments on
       ; both sides
#xd-var-global-slope-color 8
#xd-var-global-slope-Angle (/ pi 2.25) ; max angle on both sides;
  )        ; Modify the color index you need
  (if (not #xd-var-global-slope-mode)
    (setq #xd-var-global-slope-mode "1")
  )
  (xdrx-begin)
  (xdrx-sysvar-push '("RetEntList" 1))
  (xd::doc:getdouble (xdrx-string-multilanguage "\n坡线间距"
"\nSlope Line Gap"
     ) "#xd-var-global-slope-gap" 10.0
  )
  (xdrx-initget 0 "0 1 2")
  (if (setq mode (getkword (xdrx-string-formatex
(xdrx-string-multilanguage "\n坡度线模式[标准(0)/圆弧(1)/模式(2)]<1>" "\nSlope line mode[standard(0)/arc(1)/mode(2)]<%s>")
#xd-var-global-slope-mode
   )
)
      )
    (setq #xd-var-global-slope-mode mode)
  )
  (xdrx-initget)
  (if (and
(setq e1 (car (xdrx-entsel (xdrx-string-multilanguage "\n拾取坡顶线<退出>:" "\nPick top line<Exit>:")
   '((0 . "*polyline,line") (-4 . "<not")
    (-4 . "&=")
    (70 . 1)
    (-4 . "not>")
   )
      )
)
)
(setq e2 (car (xdrx-entsel (xdrx-string-multilanguage "\n拾取坡底线<退出>:" "\nPick down line<Exit>:")
   '((0 . "*polyline,line") (-4 . "<not")
    (-4 . "&=")
    (70 . 1)
    (-4 . "not>")
   )
      )
)
)
      )
    (progn
      (xdrx-setmark)
      (setq spt1 (xdrx-curve-getstartpoint e1)
    ept1 (xdrx-curve-getendpoint e1)
    spt2 (xdrx-curve-getstartpoint e2)
    ept2 (xdrx-curve-getendpoint e2)
      )
      (if (< (distance spt1 ept1) (distance spt1 spt2))
(xdrx-curve-reverse e2)
      )
      (setq top-pts1 (xdrx-curve-getpointsatdist e1 (/ #xd-var-global-slope-gap
       2.0
    )
     )
    even-list (xd::list:even top-pts1)
    even-pair (xd::list:snakepair top-pts1)
    odd-list (xd::list:odd top-pts1)
      )
      (cond
((= #xd-var-global-slope-mode "0")
  (_draw-slope-0)
)
(t
  (_draw-slope-1)
)
      )
      (setq ss (xdrx-getss))
      (xdrx-entity-setcolor ss #xd-var-global-slope-color)
      (xdrx_group_make "*" ss)
    )
  )
  (xdrx-sysvar-pop)
  (xdrx-end)
  (princ)
)
3
Test it now...
I think that now is good for both and BricsCAD and AutoCAD...

Regards, M.R.
4
Just to add note...
I tested my mod. in BricsCAD and it behaves good, but in AutoCAD it's very buggy...
Sorry, but I may not find apropriate solution for both environments...
Regards...
5
Try this mod... But selection of grips were not preserved when selected the same entity and because of that added (GETSTRING) after (SSSETFIRST)...

Code - Auto/Visual Lisp: [Select]
  1. (DEFUN c:seltst ( / *error* loop num str hgl sss ss ent1 ent2 )
  2.  
  3.   (DEFUN *error* ( m )
  4.     (IF hgl
  5.       (SETVAR (QUOTE highlight) hgl)
  6.     )
  7.     (IF m
  8.       (PROMPT m)
  9.     )
  10.     (PRINC)
  11.   )
  12.  
  13.   (SETQ loop T)
  14.   (SETQ num 0)
  15.   (SETQ str "first")
  16.   (SETQ hgl (GETVAR (QUOTE highlight)))
  17.   (SETVAR (QUOTE highlight) 1)
  18.   (SETQ sss (SSADD))
  19.   (WHILE loop
  20.     (PRINC (STRCAT "\nSelect " str " item : "))
  21.     (IF (AND ent1 (SSMEMB ent1 ss))
  22.       (SSDEL ent1 ss)
  23.     )
  24.     (WHILE (OR (NOT ss) (AND ss (= (SSLENGTH ss) 0)))
  25.       (SETQ ss (SSGET "_+.:E:S"))
  26.     )
  27.     (COND
  28.       ( (AND ss (= (SSLENGTH ss) 1) (= num 0))
  29.         (SETQ ent1 (SSNAME ss 0))
  30.         (SETQ num (1+ num))
  31.         (SETQ str "second")
  32.         (SSADD ent1 sss)
  33.       )
  34.       ( T
  35.         (SETQ loop nil)
  36.         (IF (AND ss (EQ ent1 (SETQ ent2 (SSNAME ss 0))))
  37.           (PROGN
  38.             (SETQ loop T)
  39.             (SSDEL ent1 ss)
  40.           )
  41.           (IF (OR (NOT ss) (= (SSLENGTH ss) 0))
  42.             (SETQ loop T)
  43.           )
  44.         )
  45.         (IF (AND ent2 (NOT (EQ ent1 ent2)))
  46.           (SSADD ent2 sss)
  47.         )
  48.       )
  49.     )
  50.     (SSSETFIRST nil sss)
  51.     (IF (OR (AND ent1 (NOT ent2)) (AND ent1 ent2 (EQ ent1 ent2)))
  52.       (PROGN
  53.         (GETSTRING "\nENTER TO CONTINUE...")
  54.         (SSSETFIRST)
  55.       )
  56.     )
  57.   )
  58.   (PRINC "\nFirst item : ")
  59.   (PRINC ent1)
  60.   (PRINC "\nSecond item : ")
  61.   (PRINC ent2)
  62.   (*error* nil)
  63. )
  64.  

M.R.
6
.NET / Re: Using the Generic KeyValuePair<>
« Last post by Atook on Today at 12:51:58 AM »
Woah, I just discovered Tony's github..

Thanks Tony!



7
AutoLISP (Vanilla / Visual) / Re: entsel with ability enter numbers?
« Last post by V@no on April 30, 2024, 10:19:26 PM »
My current hack is to include numbers in INITGET:
Code - Auto/Visual Lisp: [Select]
  1. (DEFUN c:test (/ commands i input)
  2.  
  3.     (SETQ commands ""
  4.           i        -1
  5.     )
  6.     (REPEAT 101
  7.         (SETQ commands (STRCAT commands " " (ITOA (SETQ i (1+ i)))))
  8.     )
  9.     (INITGET commands)
  10.     (SETQ input (ENTSEL "\nSelect object or enter a number 0-100: "))
  11.     (IF (= (TYPE input) 'STR)
  12.         (SETQ input (ATOI input))
  13.     )
  14.     (PRINC "\nresult: ")
  15.     (PRINC input)
  16.     (PRINC)
  17. )
It works for my needs, but it's just an ugly hack...
8
AutoLISP (Vanilla / Visual) / Re: entsel with ability enter numbers?
« Last post by V@no on April 30, 2024, 08:57:54 PM »
SSGET might not be what I'm looking for, because it returns selected entity instead of prompt user (I need prompt user to select 2 entities individually, and keep first entity selected, while picking second one)
9
I'd like to use SSGET to prompt user to select certain entities (let's say only lines). However if there is already a selection but doesn't pass the filter (a circle selected) SSGET returns nil instead of prompt user to select.

Is there a way force to prompt user without clearing the selection?

Basically, what I'm trying to accomplish is: prompt user so select a single entity (using ":S"). Highlight that entity, prompt user to select second entity but don't allow select first one.

During these prompts I also allow user change options, therefor I'm running SSGET in a loop, however on second "prompt" it automatically returns nil instead of prompting user.

Any ideas how to achieve this?

Thank you.

Code - Auto/Visual Lisp: [Select]
  1. (DEFUN c:test (/ loop num filter str ss sss ent1 ent2)
  2.     (SETQ loop   T
  3.           num    0
  4.           filter nil
  5.           str    "first"
  6.           sss    (SSADD)
  7.     )
  8.     (WHILE loop
  9.         (PRINC (STRCAT "\nSelect " str " item: "))
  10.         (SETQ ss (SSGET "_:S" filter))
  11.         (print ss)
  12.         (IF (AND ss (> (SSLENGTH ss) 0) (= num 0))
  13.             (PROGN
  14.                 (SETQ ent1   (ENTGET (SSNAME ss 0))
  15.                       filter (LIST (CONS -4 "!=") (CAR ent1))
  16.                       num    (1+ num)
  17.                       str    "second"
  18.                       sss    (SSADD (SSNAME ss 0) sss)
  19.                 )
  20.             )
  21.             (PROGN
  22.                 (SETQ loop nil)
  23.  
  24.                 (IF ss
  25.                     (SETQ ent2 (SSNAME ss 0)
  26.                           sss  (SSADD ss sss)
  27.                     )
  28.                 )
  29.             )
  30.         )
  31.         (SSSETFIRST nil sss)
  32.     )
  33.     (PRINC "\nfirst item: ")
  34.     (PRINC ent1)
  35.     (PRINC "\nsecond item: ")
  36.     (PRINC ent2)
  37.     (PRINC)
  38. )
10
AutoLISP (Vanilla / Visual) / Re: entsel with ability enter numbers?
« Last post by BIGAL on April 30, 2024, 08:22:19 PM »
Do you mean select 5 objects but using ssget filters ? Using repeat may be the way to go. And look at Lee-Mac ssget functions, in particular :E
Pages: [1] 2 3 ... 10