Jump to content

Command "-BOUNDARY" not working


MLast

Recommended Posts

(COMMAND "-BOUNDARY" '((+ (CAR startPoint) (/ width 2.0)) (- (CADR rectEnd)  100.5)) "")

I'm trying to create a polyline from the intersection of a region and a closed polyline. 

 

From other posts I've seen that the -BOUNDARY function can be used to do this, I've also tried to use the "INTERSECT" boolean function but to no avail. 

 

When using the function manually in AutoCAD 2011 I can simply choose a point that lies in the area I want and then press enter to create the desired closed polyline

 

I get no errors but the function doesnt complete.

 

I've provided the line in question above and also my full code: 

(DEFUN C:BEAMCENTROID (/ beam startPoint nextPoint downOrUp stepSize width stepNum rectStart rectEnd intersectRect)
  (PRINC "\nSelect Region:")
  (SETQ beam (SSGET ":S" '((0 . "REGION")))) ;;Select Beam Region
  
    (COND
      
      ((/= beam NIL)(PRINC "\nSuccessful Selection!")
       
        (SETQ startPoint (GETPOINT "\nSelect zero point"))
        (PRINC (STRCAT "\nZero Y point is Y = " (RTOS (CADR startPoint)))) ;;Select the Y value to treat as zero point for centroid calculation
        (SETQ downOrUp (GETSTRING "\nAdvance Y value down or up? [DOWN/UP]:"))
        (WHILE (AND (/= (STRCASE downOrUp) "DOWN") (/= (STRCASE downOrUp) "UP"));;downwards or upwards through the beam NEED TO IMPLEMENT, CURRENTLY ONLY GOES DOWN
	  (SETQ downOrUp (GETSTRING "\nAdvance Y value down or up? [DOWN/UP]:"))
        )
        (SETQ stepSize (GETDIST "\nEnter Step Distance:"))
        (SETQ width (GETDIST "\n Enter Width:"))
        (SETQ prevMode (GETVAR 'OSMODE))
	(SETVAR 'OSMODE 0)
        (SETQ stepNum 1.0)

        (SETQ totalDist (GETDIST "\nEnter Total Distance to traverse\n or 0 to do whole height of beam:"))
	(IF (<= totalDist 0.0) (SETQ totalDist (CADR startPoint)))
          (WHILE (<= (* stepNum stepSize) totalDist)
            (SETQ nextPoint (LIST (+ (* 2.0 width) (CAR startPoint) ) (CADR startPoint) (CADDR startPoint)));;CREATES COPY OF BEAM SEPERATED ITS WIDTH
            (COMMAND "._COPY" beam "" startPoint nextPoint)
          
            (SETQ beam (SSGET "L")) ;;SELECTS COPY OF BEAM
	    (SETQ startPoint nextPoint)
  
	    (SETQ rectStart (LIST (CAR startPoint) (- (CADR startPoint) (* stepNum stepSize)) (CADDR startPoint)))
	  
  	    (SETQ rectEnd (LIST (+ (CAR startPoint) width) (+ (CADR startPoint) 100.0) (CADDR startPoint)))
	  
	    (COMMAND "_RECTANGLE" rectStart rectEnd)
	    (SETQ intersectRect (SSGET "L")) ;;SELECTS COPY OF rectangle
	    ;;(COMMAND "REGION" intersectRect "")
	    ;;(SETQ intersectRect (SSGET "P")) ;;selects created rectangle region

	    
	    (COMMAND "-BOUNDARY" '((+ (CAR startPoint) (/ width 2.0)) (- (CADR rectEnd)  100.5)) "")
	    
	    (SETQ stepNum (+ stepNum 1.0))
	)
      )
      
      (T (PRINC "\nNothing selected"))
    )
  (SETVAR 'OSMODE prevMode)
  (PRINC)
)

Thanks in Advance! 😁

boundary.png

Link to comment
Share on other sites

Your structure of the list is the culprit and not the boundary command. ;) 

I did not get through you codes but I am correcting the statement that you alluded to.

(COMMAND "-BOUNDARY" (list (+ (CAR startPoint) (/ width 2.0)) (- (CADR rectEnd)  100.5)) "")

 

  • Thanks 1
Link to comment
Share on other sites

Thanks Tharwat!,

 

it now seems to have a new problem, this is the console output:

Command: -BOUNDARY
Specify internal point or [Advanced options]: Selecting everything...
Selecting everything visible...
Analyzing the selected data...
Point is directly on an object.
Specify internal point or [Advanced options]:

I've double checked the point's coordinates and I'm sure it lies within the area I am after and not on one of the edges.

 

Any clues?

Link to comment
Share on other sites

33 minutes ago, MLast said:

Thanks Tharwat!,

 

it now seems to have a new problem, this is the console output:


Command: -BOUNDARY
Specify internal point or [Advanced options]: Selecting everything...
Selecting everything visible...
Analyzing the selected data...
Point is directly on an object.
Specify internal point or [Advanced options]:

I've double checked the point's coordinates and I'm sure it lies within the area I am after and not on one of the edges.

 

Any clues?

 

I've fixed it, It's now working, the problem was with the areas not being within the viewport. 

 (vla-zoomcenter (vlax-get-acad-object) (vlax-3d-point (3DPOINT)) (getvar 'viewsize))

was the fix, 

It moves the viewport so that it's centred on the point 3DPOINT

 

Thanks again!

Link to comment
Share on other sites

2 minutes ago, MLast said:

 

I've fixed it, It's now working, the problem was with the areas not being within the viewport. 

 

 

Yes that has to be visualized on the screen to let the command creates the boundary.

But I don't think that your addition with the zoom function is correct and it has a variable that is not assigned yet into your routine and extra arguments for sure. ;) 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...