Author Topic: Flag on block  (Read 3665 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Flag on block
« on: June 11, 2013, 06:51:25 AM »
Hello!

Have somebody a idea, how I can create a program, which can draw a flag (line) from a block centrepoint to a variable pickpoint. But the line doesn´t draw throw the block.

The example works only with insertpoint of block. It would be nicer if the flag shows to middle of the block (se image)
Code: [Select]
(defun c:test ()
    (if (and (setq obj (entsel "\n Select a block! "))
             (if (member (cdr (assoc 0 (entget (car obj)))) '("INSERT"))
                 (setq blockpt (cdr (assoc 10 (entget (car obj)))))
                 )
             (setq fpt (getpoint "\nPick a point "))
             )
        (entmake (list '(0 . "LINE") '(67 . 0) '(410 . "Model") (cons 8 (getvar "CLAYER")) (cons 10 blockpt) (cons 11 fpt)))
        )
    (princ)
    )

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Flag on block
« Reply #1 on: June 11, 2013, 07:59:21 AM »
I'd look at Lee's auto block break (or whatever it's called). I know he used a method of getting the extents of the block.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Flag on block
« Reply #2 on: June 11, 2013, 08:18:39 AM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Flag on block
« Reply #3 on: June 11, 2013, 08:37:11 AM »
Thanks I hope I can fix it now

trogg

  • Bull Frog
  • Posts: 255
Re: Flag on block
« Reply #4 on: June 11, 2013, 09:51:52 AM »
Inspired by your efforts, i created a simple dynamic block called "Flag bubble" (attached) that might be a useful starting point.

The line that points to an object can be stretched like using an endpoint hot grip on a normal line. I simply have the line extended to the center point of the circle but hide that portion using a wipeout. The Draw order was adjusted to make the wipeout only cover the section of the line that is to be hidden.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flag on block
« Reply #5 on: June 11, 2013, 10:09:39 AM »
Here's one I put together a few years back :)


Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Flag on block
« Reply #6 on: June 11, 2013, 12:01:08 PM »
Oh that´s great, I have think about to create a dynamic block. Is it possible to create the line in block after picking. I mean so

Code: [Select]
(defun c:qnr ( / )


 (defun abfrage (txt default / get-x Out)
    (setq get-x
          (cond
              ((= (type default) 'STR) getstring)
              ((= (type default) 'INT) getint)
          )
    )
   
    (if get-x
          (if (and
                  (setq Out (get-x (strcat "\n" txt " <"(vl-princ-to-string default) ">: ")))
                  (not (= Out ""))
              )
              Out
              default
          )
    )
)
   
 (if (null nr) (setq nr 0))
 (setq nr (abfrage "\nStartnummer: " nr ))
 (setq nr (1- nr))
 
 (setvar "ATTREQ" 1)
 (setvar "CMDECHO" 1)
 (setvar "OSMODE" 0)

 (setq z 0)
 (while (>= z 0)
   (if (setq obj (entsel "\n Select symbol! "))
            (if (member (cdr (assoc 0 (entget (car obj)))) '("INSERT"))
                (if (= (type (cdr (assoc 0 (entget (car obj))))) 'STR)
                    (progn
                        (setq data (entget (car obj)))
                        (princ (strcat " <" (setq str (cdr (assoc 2 data))) ">"))

                        (setvar "CMDECHO" 0)
                        (if (/= str nil)
                            (progn
                                (command "_layer" "_m" "M-SKYLTNUMMER" "")
                                (command "_insert" "knr" (setq pt (getpoint "\nPosition nr.!")) (getvar "DIMSCALE") (getvar "DIMSCALE") 0
                                         (rtos (setq nr (1+ nr)) 2 0)
                                         str
                                         )
                                )
                            )
                        (if (setq fpt (getpoint "\nPick a flag point "))
                            (entmake (list '(0 . "LINE") '(67 . 0) '(410 . "Model") (cons 8 "M-SKYLTNUMMER") (cons 10 pt) (cons 11 fpt)))
                            )
                        )
                    )
                )
       (alert "No symbol choice ")
       )
     )
    )

I want picking first a symbolblock and than create a block with 2 attributes (1. number 2. blockname). When I pick new position for numberblock I want it draws "paramatic  line" from symbolblock to numberblock. Can you follow me?

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Flag on block
« Reply #7 on: June 12, 2013, 02:51:22 AM »
Very nice with your blocksamples, I have learned a bit more. Thank you all

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Flag on block
« Reply #8 on: June 13, 2013, 02:58:50 AM »
Here's one I put together a few years back :)

This is really a cool dynamic block! Thanks for sharing :-)
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Flag on block
« Reply #9 on: June 13, 2013, 07:47:58 AM »
Here's one I put together a few years back :)

'Squiggles'  :-D

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flag on block
« Reply #10 on: June 13, 2013, 10:03:04 AM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Flag on block
« Reply #11 on: June 13, 2013, 04:17:32 PM »
Here's one I put together a few years back :)
Now that is an impressive dynamic block.  :kewl:
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flag on block
« Reply #12 on: June 13, 2013, 06:09:40 PM »
Here's one I put together a few years back :)
Now that is an impressive dynamic block.  :kewl:


Thanks Alan :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Flag on block
« Reply #13 on: June 13, 2013, 09:54:41 PM »
Inspired by your efforts, i created a simple dynamic block called "Flag bubble" (attached) that might be a useful starting point.

The line that points to an object can be stretched like using an endpoint hot grip on a normal line. I simply have the line extended to the center point of the circle but hide that portion using a wipeout. The Draw order was adjusted to make the wipeout only cover the section of the line that is to be hidden.

Aww I thought I was doing so well with what I made and here I missed the boat! Instead of a wipeout I do a polar stretch on the end of the line and a move on the circle and attribute.

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Flag on block
« Reply #14 on: June 14, 2013, 03:04:06 AM »

..

Aww I thought I was doing so well with what I made and here I missed the boat! Instead of a wipeout I do a polar stretch on the end of the line and a move on the circle and attribute.

That is also a cool one :-)






(but the ronjonp block is cooler ;-) )
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.