Author Topic: What is diffirence between BLOCK and INSERT?  (Read 2780 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1420
What is diffirence between BLOCK and INSERT?
« on: July 19, 2010, 03:37:04 AM »
What is difference between a block definition (BLOCK) and block references (INSERT)?

Code: [Select]
(defun HM:add_Coordblock ()
  (if (not (tblsearch "block" "EC-CoordPoint"))
    (progn
      (entmake (list (cons 0 "BLOCK")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 8 "0")
(cons 100 "AcDbBlockReference")
(cons 2 "EC-CoordPoint")
(cons 10 (nth (+ 5 n) XlsLst) (nth (+ 6 n) XlsLst) (nth (+ 7 n) XlsLst)) ;base point
(cons 70 0)
)
       )

      (entmake (list (cons 0 "POINT")
(cons 100 "AcDbEntity")
         (cons 67 0)
         (cons 8 "0")
         (cons 100 "AcDbPoint")
         (cons 10 0.0 0.0 0.0)
         (cons 50 0.0)
)
       )

      (entmake (list (0 "ATTDEF")
         (cons 100 "AcDbEntity")
         (cons 67 0)
         (cons 8 "0")
         (cons 100 "AcDbText")
         (cons 10 -1433.142857142857 -110.0 0.0)
         (cons 40 220.0)
         (cons 1 (nth (+ 4 n) XlsLst)) ;Vlaue
         (cons 50 0.0)
         (cons 41 0.8)
         (cons 51 0.0)
         (cons 7 "EC-22-100")
         (cons 71 0)
         (cons 72 1)
         (cons 11 0.0 0.0 0.0)
         (cons 100 "AcDbAttributeDefinition")
         (cons 3 "EC-CoordPoint_PROMPT")
         (cons 2 "EC-COORDPOINT_TAG")
         (cons 70 0)
         (cons 73 0)
         (cons 74 2)
         (cons 280 0)
)
       )

      (entmake (list (cons 0 "ENDBLK")
(cons 100 "AcDbBlockEnd")
(cons 8 "0")
)
       )
      )
    )

  (princ)
  )


Thanks

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What is diffirence between BLOCK and INSERT?
« Reply #1 on: July 19, 2010, 03:46:54 AM »

Haven't tried your code, but a couple of questions ..

What do you think the code does ?

What is the value of n ?

What is the value of XlsLst ?

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is diffirence between BLOCK and INSERT?
« Reply #2 on: July 19, 2010, 04:37:21 AM »
I am tring to import a data from xls file using Gile tool Excel read and write

The full idea is
- Import points coordenate from excel file
- Then process these points in AutoCAD (move and rotate) to match the master plan
- Then export the new data to an excel sheet again.

What I am thinking is creating a block with insertion point and an attribute with point number to be able to export to the excel sheet with the points sequance

Attached a snapshot for the excel sheet

Code: [Select]
(defun c:CoordBlock ()
  (vl-load-com)

    (setq time (getvar "millisecs")
  n -1
  XlsLst (gc-xlread "C:/EC-Menu/Help/EC-Coordinates.xls" "Coord")
  )

  (while
    (HM:add_Coordblock)
    (setq n (1+ n))
    )
   
(defun HM:add_Coordblock ()
  (if (not (tblsearch "block" "EC-CoordPoint"))
    (progn
      (entmake (list (cons 0 "BLOCK")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 8 "0")
(cons 100 "AcDbBlockReference")
(cons 2 "EC-CoordPoint")
(cons 10 (nth (+ 5 n) XlsLst) (nth (+ 6 n) XlsLst) (nth (+ 7 n) XlsLst)) ;base point
(cons 70 0)
)
       )

      (entmake (list (cons 0 "POINT")
(cons 100 "AcDbEntity")
         (cons 67 0)
         (cons 8 "0")
         (cons 100 "AcDbPoint")
         (cons 10 0.0 0.0 0.0)
         (cons 50 0.0)
)
       )

      (entmake (list (0 "ATTDEF")
         (cons 100 "AcDbEntity")
         (cons 67 0)
         (cons 8 "0")
         (cons 100 "AcDbText")
         (cons 10 -1433.142857142857 -110.0 0.0)
         (cons 40 220.0)
         (cons 1 (nth (+ 4 n) XlsLst)) ;Vlaue
         (cons 50 0.0)
         (cons 41 0.8)
         (cons 51 0.0)
         (cons 7 "EC-22-100")
         (cons 71 0)
         (cons 72 1)
         (cons 11 0.0 0.0 0.0)
         (cons 100 "AcDbAttributeDefinition")
         (cons 3 "EC-CoordPoint_PROMPT")
         (cons 2 "EC-COORDPOINT_TAG")
         (cons 70 0)
         (cons 73 0)
         (cons 74 2)
         (cons 280 0)
)
       )

      (entmake (list (cons 0 "ENDBLK")
(cons 100 "AcDbBlockEnd")
(cons 8 "0")
)
       )
      )
    )

  (princ)
  )
  (princ (strcat "\n<< Time took: " (rtos (/ (- (getvar "millisecs") time) 1000.) 2 4) " secs. >>"))
  )


Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: What is diffirence between BLOCK and INSERT?
« Reply #3 on: July 19, 2010, 06:38:16 AM »

Well, BLOCK is made of gathered entities to be used later on as one object in a drawing of Autocad.  :ugly:
So the INSERT is the mechanical process to get your BLOCK come true in reality.. is that clear  :pissed:
 :-D  :-D  :-D

Tharwat

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What is diffirence between BLOCK and INSERT?
« Reply #4 on: July 19, 2010, 06:42:35 AM »
Quote
What do you think the code does ?
has not been resolved.

To deal with block definition and inserts using entmake :

FIRST :
If the BLOCK definition is not in the Block Table
then create the BLOCK
  • 1. Entmake the BLOCK entity.
  • 2. Entmake one ATTDEF entity for each attribute.
  • 3. Entmake a ENDBLK entity.

Then SECOND :
  To create the INSERT
  • 1. Entmake the INSERT entity.
  • 2. Entmake one ATTRIB entity for each attribute.
  • 3. Entmake a SEQEND entity.



When you can do that you can start to consider automating the process
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: What is diffirence between BLOCK and INSERT?
« Reply #5 on: July 19, 2010, 02:16:19 PM »
Perhaps read this thread also.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What is diffirence between BLOCK and INSERT?
« Reply #6 on: July 20, 2010, 05:31:11 AM »
Quote

Hello.
Is there anybody in there?
Just nod if you can hear me.
Is there anyone home?


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: What is diffirence between BLOCK and INSERT?
« Reply #7 on: July 20, 2010, 05:39:39 AM »
Quote

Hello.
Is there anybody in there?
Just nod if you can hear me.
Is there anyone home?



Hi!  :-)

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is diffirence between BLOCK and INSERT?
« Reply #8 on: July 20, 2010, 07:41:01 AM »
Quote

Hello.
Is there anybody in there?
Just nod if you can hear me.
Is there anyone home?




Hi Kerry

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: What is diffirence between BLOCK and INSERT?
« Reply #9 on: July 20, 2010, 11:19:09 AM »
The difference between a BLOCK and an INSERT (more correctly, a block reference) is the difference between a blueprint and the actual building.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Hangman

  • Swamp Rat
  • Posts: 566
Re: What is diffirence between BLOCK and INSERT?
« Reply #10 on: July 20, 2010, 03:00:57 PM »
The difference between a BLOCK and an INSERT (more correctly, a block reference) is the difference between a blueprint and the actual building.

So, ... your saying that ... a BLOCK is to a Building what an INSERT is to a blueprint ??<Sarc>   :-D

(grrrr, ... stupid sarc marks ain't work'n)   :realmad:
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: What is diffirence between BLOCK and INSERT?
« Reply #11 on: July 20, 2010, 03:31:46 PM »
Other way 'round - the BLOCK is the blueprint, which provides the instructions to build the actual object; in this case, a block reference.  Many buildings can be built off of the same blueprint, but they can (and usually do) vary slightly depending on who put them on site.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}