Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ERROR IN RECTANGLE LISP

9 REPLIES 9
Reply
Message 1 of 10
jaimuthu
307 Views, 9 Replies

ERROR IN RECTANGLE LISP

(DEFUN C:PS()
  (SETQ
    EW (GETREAL "\n Enter WIDTH OF PLOT:")
    EL (GETREAL "\n Enter LENGTH OF PLOT:")
    RW (GETREAL "\n ENTER ROAD WIDTH:")
   
    
    ERS (GETREAL "\nEnter PLOT RIGHTSIDE SET BACK 1:")
    ELS (GETREAL "\nEnter PLOT LEFTSIDE SET BACK 2:")
    EFS (GETREAL "\nEnter PLOT FRONTSIDE SET BACK:")
    EBS (GETREAL "\nEnter PLOT REARSIDE SET BACK:")
    ST (GETPOINT "\nPick a point:")
    ORSL (- EL (+ EFS EBS))
    OFSL (- EW (+ ERS ELS))
    RP1 (POLAR ST 0 EW)
    RP2 (POLAR RP1 (/ PI 2) EFS) ; RIGHT SIDE SET BACK FIRST CORNER
    LP2 (POLAR ST (/ PI 2) EFS) ; LEFT SIDE SET BACK FIRST CORNER
    FP1 (POLAR ST 0 ELS) BP1(POLAR FP1 ( / PI 2) (- EL EBS))

   TP1(POLAR ST 0 (/ EW 2)) TP2(POLAR TP1 ( / PI 2) (/ EL 2))
   MP1(POLAR ST 0 (+ EW 20))

    P2(POLAR ST (/ PI 2) EL) P3(POLAR P2 0 ELS)

    RP1(POLAR ST (+ PI( / PI 2)) 10)
    
  )
  (SETQ P1 (POLAR ST 0 10))

  (COMMAND "RECTANGLE" ST "D" EW EL P1) ; PLOT AREA

  

  
  
  (SETQ OBJ1 (ENTLAST))

  (COMMAND "RECTANGLE" ST "D" EW RW RP1) ; ROAD AREA

  (SETQ ROBJ1 (ENTLAST))

  (COMMAND "CHPROP" ROBJ1 "" "LA" "ROAD_WIDTH" "CO" 1 "")

  ; Change the layer and color of the first rectangle
  (COMMAND "CHPROP" OBJ1 "" "LA" "PLOT_BOUNDARY" "CO" 70 "")

  (COMMAND "COPY" OBJ1 "" "12,0" "12,0" "")(SETQ COBJ1(ENTLAST))

  (COMMAND "CHPROP" COBJ1 "" "LA" "FMB_OR_PLR" "CO" 70 "")

  (COMMAND "COPY" OBJ1 "" "16,0" "16,0" "")(SETQ COBJ2(ENTLAST))

  (COMMAND "CHPROP" COBJ2 "" "LA" "AS_AT_SITE" "CO" 6 "")

  (COMMAND "COPY" OBJ1 "" "18,0" "18,0" "")(SETQ COBJ3(ENTLAST))

  (COMMAND "CHPROP" COBJ3 "" "LA" "SUPER_IMPOSED" "CO" 5 "")



  (SETQ P1 (POLAR ST (/ PI 2) 10))

  (COMMAND "RECTANGLE" RP2 "D" ERS ORSL P1) ; RIGHT SIDE SET BACK

  

  (SETQ OBJ2 (ENTLAST))

  ; Change the layer and color of the second rectangle
  (COMMAND "CHPROP" OBJ2 "" "LA" "BLK_1_LVL_0_SIDE_SETBACK1"  "CO" 171 "")


  (SETQ P1 (POLAR ST (/ PI 2) 10))

  (COMMAND "RECTANGLE" LP2 "D" ELS ORSL P1) ; LEFT SIDE SET BACK

  

  (SETQ OBJ3 (ENTLAST))

  ; Change the layer and color of the third rectangle
  (COMMAND "CHPROP" OBJ3 "" "LA" "BLK_1_LVL_0_SIDE_SETBACK2"  "CO" 102 "")


  (SETQ P1 (POLAR ST 0 10))

  (COMMAND "RECTANGLE" FP1 "D" OFSL EFS P1) ; FRONT SIDE SET BACK

  

  (SETQ OBJ4(ENTLAST))

  ; Change the layer and color of the fourth rectangle
  (COMMAND "CHPROP" OBJ4 "" "LA" "BLK_1_LVL_0_FRONT_SETBACK"  "CO" 2 "")


  (SETQ P1 (POLAR BP1 0 10))

  (COMMAND "RECTANGLE" P3 "D" OFSL EBS P1) ; BACK SIDE SET BACK

  (SETQ OBJ4(ENTLAST))

  ; Change the layer and color of the fifth rectangle
  (COMMAND "CHPROP" OBJ4 "" "LA" "BLK_1_LVL_0_REAR_SETBACK"  "CO" 11 "")

  (SETQ P1 (POLAR BP1 (+ PI (/ PI 2)) 10))

  (COMMAND "RECTANGLE" BP1 "D" OFSL ORSL P1) ; BUILT UP AREA

  (SETQ OBJ5(ENTLAST))

  ; Change the layer and color of the sixth rectangle
  (COMMAND "CHPROP" OBJ5 "" "LA" "BLK_1_FLR_0_BLT_UP_AREA"  "CO" 1 "")

  

  (COMMAND "TEXT" "J" "MC" TP2 0.5 0 "Built up Area Draw Plan" "")(SETQ OBJ6(ENTLAST))
  (COMMAND "CHPROP" OBJ6 "" "LA" "0"  "CO" 7 "")
  
  (COMMAND "COPY" OBJ5 OBJ6 "" ST MP1 "")

  (COMMAND "COPY" OBJ5 "" "20,0" "20,0"  "")(SETQ COBJ4(ENTLAST))

  (COMMAND "CHPROP" COBJ4 "" "LA" "BLK_1_LVL_0_BLDG_FOOT_PRINT" "CO" 1"")

  (COMMAND "COPY" OBJ5 "" "22,0" "22,0" "")(SETQ COBJ5(ENTLAST))

  (COMMAND "CHPROP" COBJ5 "" "LA" "BLK_1_FLR_0_ROOF_AREA" "CO" 54 "")

  (COMMAND "COPY" OBJ5 "" "24,0" "24,0" "")(SETQ COBJ6(ENTLAST))

  (COMMAND "CHPROP" COBJ6 "" "LA" "BLK_1_COVERED_AREA" "CO" 140 "")
    
)

THIS CODE RUN SOMETIMES CORRECT MANY TIMES ERROR WHAT I MISTAKE THIS  I ATTACHED FILE IN DETAIL EXPLAIN 

9 REPLIES 9
Message 2 of 10
ВeekeeCZ
in reply to: jaimuthu

Try to set OSNAPCOORD 2 and see if sometimes becomes always.

Message 3 of 10
jaimuthu
in reply to: ВeekeeCZ

OSNAPCOORD 2 already its autocad
Message 4 of 10
ВeekeeCZ
in reply to: jaimuthu

Sorry, I meant 1.

Message 5 of 10
jaimuthu
in reply to: ВeekeeCZ

i set 1 same error 

Message 6 of 10
ВeekeeCZ
in reply to: jaimuthu

Tell the exact values when it works and when not

 

    EW (GETREAL "\n Enter WIDTH OF PLOT:")
    EL (GETREAL "\n Enter LENGTH OF PLOT:")
    RW (GETREAL "\n ENTER ROAD WIDTH:")
   
    
    ERS (GETREAL "\nEnter PLOT RIGHTSIDE SET BACK 1:")
    ELS (GETREAL "\nEnter PLOT LEFTSIDE SET BACK 2:")
    EFS (GETREAL "\nEnter PLOT FRONTSIDE SET BACK:")
    EBS (GETREAL "\nEnter PLOT REARSIDE SET BACK:")

 

 

Message 7 of 10
jaimuthu
in reply to: ВeekeeCZ

EW (GETREAL "\n Enter WIDTH OF PLOT:") 9.85
EL (GETREAL "\n Enter LENGTH OF PLOT:") 15.83
RW (GETREAL "\n ENTER ROAD WIDTH:") 3
ERS (GETREAL "\nEnter PLOT RIGHTSIDE SET BACK 1:") 0.76
ELS (GETREAL "\nEnter PLOT LEFTSIDE SET BACK 2:") 0.76
EFS (GETREAL "\nEnter PLOT FRONTSIDE SET BACK:") 3
EBS (GETREAL "\nEnter PLOT REARSIDE SET BACK:") 0.76
Message 8 of 10
ВeekeeCZ
in reply to: jaimuthu

See this command line listing. This is your help. One issue per bolded lines that needs to be fixed. Usually it's one extra "" or something like that.


Command: PS

Enter WIDTH OF PLOT:9.85

Enter LENGTH OF PLOT:15.83

ENTER ROAD WIDTH:3.00

Enter PLOT RIGHTSIDE SET BACK 1:0.76

Enter PLOT LEFTSIDE SET BACK 2:0.76

Enter PLOT FRONTSIDE SET BACK:3.00

Enter PLOT REARSIDE SET BACK:0.76

Pick a point:RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <8.33>: 9.849999999999999
Specify width for rectangles <12.07>: 15.83
Specify other corner point or [Area/Dimensions/Rotation]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <9.85>: 9.849999999999999
Specify width for rectangles <15.83>: 3
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: ROAD_WIDTH
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 1
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: PLOT_BOUNDARY
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 70
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 12,0
Specify second point or [Array] <use first point as displacement>: 12,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <PLOT_BOUNDARY>: FMB_OR_PLR
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <70>: 70
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 16,0
Specify second point or [Array] <use first point as displacement>: 16,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <PLOT_BOUNDARY>: AS_AT_SITE
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <70>: 6
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 18,0
Specify second point or [Array] <use first point as displacement>: 18,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <PLOT_BOUNDARY>: SUPER_IMPOSED
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <70>: 5
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <9.85>: 0.76
Specify width for rectangles <3.00>: 12.07
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: BLK_1_LVL_0_SIDE_SETBACK1
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 171
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <0.76>: 0.76
Specify width for rectangles <12.07>: 12.07
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: BLK_1_LVL_0_SIDE_SETBACK2
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 102
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <0.76>: 8.33
Specify width for rectangles <12.07>: 3
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: BLK_1_LVL_0_FRONT_SETBACK
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 2
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <8.33>: 8.33
Specify width for rectangles <3.00>: 0.76
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: BLK_1_LVL_0_REAR_SETBACK
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 11
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: D
Specify length for rectangles <8.33>: 8.33
Specify width for rectangles <0.76>: 12.07
Specify other corner point or [Area/Dimensions/Rotation]:
Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: BLK_1_FLR_0_BLT_UP_AREA
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 1
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: TEXT
Current text style: "Standard" Text height: 0.77 Annotative: No Justify: Left
Specify start point of text or [Justify/Style]: J Enter an option [Left/Center/Right/Align/Middle/Fit/TL/TC/TR/ML/MC/MR/BL/BC/BR]: MC
Specify middle point of text:
Specify height <0.77>: 0.5
Specify rotation angle of text <0>: 0
Enter text: Built up Area Draw Plan
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_ROOM_1_LIGHT_VENTILATION_1>: 0
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 7
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects: 1 found, 2 total

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>:
Specify second point or [Array] <use first point as displacement>:
Command: PS
Unknown command "PS". Press F1 for help.

Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 20,0
Specify second point or [Array] <use first point as displacement>: 20,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_BLT_UP_AREA>: BLK_1_LVL_0_BLDG_FOOT_PRINT
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 1
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 22,0
Specify second point or [Array] <use first point as displacement>: 22,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_BLT_UP_AREA>: BLK_1_FLR_0_ROOF_AREA
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 54
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: COPY
Select objects: 1 found

Select objects:
Specify base point or [Displacement/Multiple] <Displacement>: 24,0
Specify second point or [Array] <use first point as displacement>: 24,0
Command: PS
Unknown command "PS". Press F1 for help.

Command: CHPROP
Select objects: 1 found

Select objects:
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: LA
Enter new layer name <BLK_1_FLR_0_BLT_UP_AREA>: BLK_1_COVERED_AREA
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: CO
New color [Truecolor/COlorbook] <1 (red)>: 140
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:

Message 9 of 10
ВeekeeCZ
in reply to: jaimuthu

To add to the above, LISP version of the COPY command is different from the current built-it version. It's not multiple!

(COMMAND "COPY" OBJ1 "" "12,0" "12,0" ""

Message 10 of 10
Sea-Haven
in reply to: jaimuthu

Are you trying to do something like this, its a pick pline and make rectangs, then make  layouts.

SeaHaven_0-1699319234093.png

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report