Author Topic: Insertion at a point  (Read 4249 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
Insertion at a point
« on: March 30, 2004, 10:39:41 AM »
I have 2 points, p2 & p3.

I want to insert a block at  co-ordinates p2,p3  but when I put that into code it returns "error no function definition p2,p3".

Code: [Select]
(command "-insert" block (p2,p3) "1" " " "0"

how should I be writing this?
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

SMadsen

  • Guest
Insertion at a point
« Reply #1 on: March 30, 2004, 10:46:04 AM »
(foreach p (list p2 p3)
  (command "-insert" block p "1" "" "0")
)

Like that?

JohnK

  • Administrator
  • Seagull
  • Posts: 10638
Insertion at a point
« Reply #2 on: March 30, 2004, 10:49:14 AM »
That dosent make a whole lot of sence --Why are you trying to insert a block at two points at once? :P--  but is this kinda what your looking to do?
(setq pt1 (getpoint "pt1: "))
(setq pt2 (getpoint "pt2: "))
(command "line" pt1 pt2 "")
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CADaver

  • Guest
Re: Insertion at a point
« Reply #3 on: March 30, 2004, 10:50:35 AM »
Quote from: Hudster
I have 2 points, p2 & p3.
I want to insert a block at  co-ordinates p2,p3  but when I put that into code it returns "error no function definition p2,p3".

Code: [Select]
(command "-insert" block (p2,p3) "1" " " "0"
how should I be writing this?
You want a block inserted at BOTH points P2 and P3?? or some combination of the the X of one and the Y of the other?

.

JohnK

  • Administrator
  • Seagull
  • Posts: 10638
Insertion at a point
« Reply #4 on: March 30, 2004, 10:50:49 AM »
Darn, SMadsen beat me again!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Insertion at a point
« Reply #5 on: March 30, 2004, 10:58:21 AM »
You know he may have coordinates instead of points????
 8)

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Columbia

  • Guest
Insertion at a point
« Reply #6 on: March 30, 2004, 10:59:47 AM »
If you want the x of P2 and the y of p3 then try this little snippet...

Code: [Select]

(command "._insert" block (list (car p2) (cadr p3)) "1" "" "0")

hudster

  • Gator
  • Posts: 2848
Insertion at a point
« Reply #7 on: March 30, 2004, 11:03:30 AM »
that kind of worked.

P2 and p3 are seperate values which i want to use as co-ordinates, (i.e p2=100 and p3=200, so 100,200) for the inserton point of a block.

but i can't figure out how to do it.

***EDIT***

Thanks columbia that was it.

I get an "error: bad argument type: consp 1250.0" message now though.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

SMadsen

  • Guest
Insertion at a point
« Reply #8 on: March 30, 2004, 11:09:29 AM »
Oh, that was a cheater!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Insertion at a point
« Reply #9 on: March 30, 2004, 11:15:19 AM »
You want this then.

Code: [Select]
(command "-insert" block (list p2 p3) "1" " " "0"
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hudster

  • Gator
  • Posts: 2848
Insertion at a point
« Reply #10 on: March 30, 2004, 11:19:05 AM »
cheers that done it.

many thanks.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue