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

LISP to create an XCLIP

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
mmcgrathV2V8P
2013 Views, 5 Replies

LISP to create an XCLIP

Hey everyone,

 

I am looking to create an automated way of XCLIPing various sections of a GA. Basically what I am looking for is a way to XCLIP around a predefined area based on a user selection of what area they want to see. I know how to do this part but the auto XCLIP is the issue. 

 

For an example to make it clear, I have a GA shaped like the letter H, with 3 floors on it (an example, of course). When the user selects "2" I want to be able to XCLIP and only show Floor 2.  How can I use the multiple points to create the H to create the XCLIP?

 

I sure hope this is a little clear 🙂 

Tags (1)
5 REPLIES 5
Message 2 of 6
SeeMSixty7
in reply to: mmcgrathV2V8P

you should be able to simply send to the XCLIP command the points you need, but you will need to build the points list first.

 

How are you generating the points to form the H shape? What input does the user provide, versus what you auto generate.

 

There are many ways to do it, but here is one way for you to start with. Once you get it down you can find some better ways to optimize your code.

 

Good luck,

 

 

;assuming your H has 12 points. We will calculate them all out in the long 
;method, so you can see what is going on.
(setq StartPoint (getpoint "\nStartpoint:");;;...use the insertion point of the xref the user selects. dxf code of 10 or have them pick a point
        pointlist  (list startpoint) ; start a list to store the variables
        nextpoint (polar Startpoint 0.0 100.0) ; Step over 100 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint (* PI 0.5) 200); Step Up 200 points
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint 0.0 200.0) ; Step over 200 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint (* PI 1.5) 200.0) ; Step down 200 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint 0.0 100.0) ; Step over 100 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint (* PI 0.5) 500.0); Step Up 500 points to top of H
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint PI 100.0) ; Step back 100 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint (* PI 1.5) 200.0) ; Step down 200 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint PI 200.0) ; Step back 200 units
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint (* PI 0.5) 200.0); Step Up 200 points
        pointlist  (append pointlist (list nextpoint))
        nextpoint (polar nextpoint PI 100.0) ; Step back 100 units
        pointlist  (append pointlist (list nextpoint))
)
;Here we can see what it looks like
(progn
  (command "PLINE")
  (foreach pt pointlist
     (command pt)
  )
  (command "c")
)

 

 

 

 

Message 3 of 6
Kent1Cooper
in reply to: mmcgrathV2V8P


@mmcgrathV2V8P wrote:

... 

I am looking to create an automated way of XCLIPing ....  How can I use the multiple points to create the H to create the XCLIP?

 

....

If you know the dimensions of your Xclip shape, you can do something like this [here, an H shape 4 units wide by 5 units tall with 1-unit-wide strokes]:

(command "_.xclip" pause "" ; pause is for User selection of Xref/Block, but that can be pre-established
  "_p" "_n" "_p"
  (getpoint "Lower left corner of 4-wide x 5-high H: ")
  "@1,0" "@0,2" "@2,0" "@0,-2" "@1,0" "@0,5"
  "@-1,0" "@0,-2" "@-2,0" "@0,2" "@-1,0" ""
); command

With Osnap off, etc., etc.

 

If you already have your "multiple points" saved defining the shape, you can feed them in, in place of the relative-displacement point designations.

Kent Cooper, AIA
Message 4 of 6
mmcgrathV2V8P
in reply to: SeeMSixty7

I was able to get it to work but will look to improve my overall code. It seems I need to refine a few areas

Message 5 of 6
mmcgrathV2V8P
in reply to: Kent1Cooper

Kent, as always, amazing. 

Message 6 of 6
mmcgrathV2V8P
in reply to: Kent1Cooper

If the XREF comes in at the same position all the time, how do i automate the selection to just XCLIP any and all XREFs at predefined points? For example, I have the GA and the lighting layout bought in. I want to XCLIP both drawings automatically by using the following code and then zoom to the extents of the new clip:


(defun C:NewXClip (/ a)
   (initget "01 02 03")
   (setq a (getkword "\nSelect Floor [01/02/03] <01>: "))
   (cond
      ((= a "01")
      (command "_.xclip" ***some points here @2000,0,0 @0,2000,0 @2000,0,0 @0,-2000,0***)  <- ie just clip this square based on selecting "01"
      (command "-VIEW" "O" "T")
   )
   ((= a "02")
      (command "-VIEW" "O" "T")
   )
   ((= a "03")
      (command "-VIEW" "O" "T")
   )
)
(princ))

 

 

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

Post to forums  

”Boost