Author Topic: Real quick fix  (Read 3393 times)

0 Members and 1 Guest are viewing this topic.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Real quick fix
« on: January 07, 2004, 04:52:57 PM »
I am running into a prob here and need to get this to work quickly...any ideas as to whats wrong.

Code: [Select]
(DEFUN c:3dpad ()
  (SETQ cmd (GETVAR "CMDECHO")
osm (GETVAR "OSMODE")
ort (GETVAR "ORTHOMODE")
lay (GETVAR "CLAYER")
  )
  (SETVAR "CMDECHO" 0)
  (SETQ cen (GETPOINT "\nPick point in center of lot: ")
elv (GETREAL "\nPad elevation: ")
  )
  (COMMAND "._bpoly" cen "")
  (SETQ old (ENTGET (ENTLAST)))
  (COMMAND "offset" "0.50" (ENTGET (ENTLAST)) cen "")
  (VL-CMDF "ERASE" old "")
  (VL-CMDF ".-CHANGE" (ENTGET (ENTLAST)) "" "P" "E" elv "")
  (PRINC "PLEASE CONTINUE ONTO NEXT LOT...")
  (PRINC)
)


THX - Rug
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

daron

  • Guest
Real quick fix
« Reply #1 on: January 07, 2004, 05:18:33 PM »
How's that:
Code: [Select]
(DEFUN c:3dpad ()
     (SETQ cmd (GETVAR "CMDECHO")
  osm (GETVAR "OSMODE")
  ort (GETVAR "ORTHOMODE")
  lay (GETVAR "CLAYER")
     )
     (SETVAR "CMDECHO" 0)
     (SETQ cen (GETPOINT "\nPick point in center of lot: ")
  elv (GETREAL "\nPad elevation: ")
     )
     (COMMAND "._boundary" cen "")
     (SETQ old (ENTLAST))
     (COMMAND "offset" "0.50" old cen "")
     (VL-CMDF "ERASE" old "")
     (VL-CMDF ".-CHANGE" (ENTGET (ENTLAST)) "" "P" "E" elv "")
     (PRINC "PLEASE CONTINUE ONTO NEXT LOT...")
     (PRINC)
)

there is no bpoly command. Entget was too far for offset command.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Real quick fix
« Reply #2 on: January 07, 2004, 05:31:01 PM »
Ok...for some reason after the offset, for some reason it is crashing. It displays the ent name, but pauses, and then say all the rest are invalid commands
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28708
Real quick fix
« Reply #3 on: January 07, 2004, 05:39:02 PM »
>there is no bpoly command.
Maybe not for you. :D
Quote
To create the boundaries
Open the map drawing or query the map data into the project.
Create the boundaries as closed 2-dimensional polylines on a separate layer.
Use one of these methods to create the 2-D polylines:

PLINE command. See the pull-down Help menu.
BOUNDARY (BPOLY) command
MAPCLPLINE command
All polylines you create must be closed. You can also create boundaries by querying in polylines from other drawings.

Create and attach object data to the boundaries.
See Create the Boundary Object Data Table. The object data uniquely identifies the boundaries.

After attaching object data, create a separate drawing for the boundaries. To create the map sheet boundary drawing, do the following:

At the command line, enter WBLOCK.
In the Write Block dialog box, enter a file name and click OK.
At the Block name prompt, press ENTER without entering a block name.
For the Insertion base point, enter 0,0.
Select the boundaries.
When prompted to include Autodesk Map information, choose No.
The boundaries are saved as a separate drawing. If you attach object data at a later date, use WBLOCK again to update the map sheet boundary drawing with the object data.


- Rug
Quote
To draw parcels, use the line and curve commands in the Lines/Curves menu. You can also use either the PLINE command, or any AutoCAD line or curve command.

NOTE  Do not use spiral curves in the parcel geometry because incorrect parcel areas are calculated. If you want to create a parcel from a spiral, then use the BPOLY command to convert the spiral into a polyline before defining the parcel.

After you draw the parcel geometry, you must define the parcels to the parcel database. For more information, see Defining Parcels.

NOTE  Be sure to draw the parcels as closed regions. If any of the joining lines has a break, then you cannot define the parcels.
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Real quick fix
« Reply #4 on: January 07, 2004, 06:23:04 PM »
One word of caution, in any version of AutoCAD prior to 2004, whenever you query the drawing for (ENTLAST) sometimes it will not return the LAST entity if it is not visible on the screen.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

daron

  • Guest
Real quick fix
« Reply #5 on: January 07, 2004, 06:31:09 PM »
Sorry Mark. I get a dialog when running bpoly. To avoid this there is no (command "._bpoly"...) but rather (command ".boundary"...). I meant bpoly was a bad idea for use in lisp. As far as the offset problem goes, make sure the arguments in the command line equal that of what is in the code.

SMadsen

  • Guest
Real quick fix
« Reply #6 on: January 07, 2004, 06:37:24 PM »
Gotta say, it's the first time I ever saw someone use (entget (entlast)) explicitly to pass entities to a COMMAND function. :)
Didn't you guys get errors from that?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Real quick fix
« Reply #7 on: January 07, 2004, 10:10:29 PM »
Nope, but you could also use "Last" or "L" as the command option.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
Real quick fix
« Reply #8 on: January 08, 2004, 04:40:43 AM »
Nope?

Code: [Select]
(defun crashy ()
(setq ent (car (entsel))
      p1  (getpoint "\nFrom: ")
      p2  (getpoint "\nTo: ")
)
(and ent p1 p2 (vl-cmdf "MOVE" (entget ent) "" p1 p2)))

daron

  • Guest
Real quick fix
« Reply #9 on: January 08, 2004, 09:34:59 AM »
Yes, I did that's why I took it out in the first instance of it. I didn't consider the second instance of it and hoped that Rug could catch that one on his own. BTW, Rug, what's with combining command and vl-cmdf all in one routine? They both perform the same feat, just in different ways.

Stig, I once saw a guy take a selected object to an entity list, then revert it back. It was a very odd thing. Of course this person collected a bunch of variables that he didn't even use in the routine.

SMadsen

  • Guest
Real quick fix
« Reply #10 on: January 08, 2004, 10:48:39 AM »
Most built-in commands accept the list returned by ENTSEL but I never heard they could handle entity lists. Didn't mean to sound condescending, just surprised by the approach.

Daron, I bet we've all been where you describe. I still drag some pretty weird routines along with an .mnl that I wrote 14 years ago. Do I ever think about correcting it? Sure. Do I ever get around to do it? Nah...

daron

  • Guest
Real quick fix
« Reply #11 on: January 08, 2004, 10:59:42 AM »
Yeah.