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

divide with block

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
shefipmoosa
1627 Views, 9 Replies

divide with block

iam using below mentioned code for divide option.but iam getting the point style only. I need to place "selected block" instead of point style.

(defun c:div ()
  (setq val (getint " no of POINTS"))
  (setq val (* 2 val))
  (command "divide" pause val)
  (setq ss (ssget "p"))
  (setq co 1)
  (setq len (sslength ss))
  (repeat len
    (setq en (ssname ss co))
    (setq det (entget en))
    (entdel en)
    (setq co (+ co 2))
  )
)
9 REPLIES 9
Message 2 of 10
3wood
in reply to: shefipmoosa

There is a Block option in DIVIDE command. No need lisp.

Capture.PNG

Message 3 of 10
dlanorh
in reply to: shefipmoosa


@shefipmoosa wrote:

iam using below mentioned code for divide option.but iam getting the point style only. I need to place "selected block" instead of point style.

(defun c:div ()
  (setq val (getint " no of POINTS"))
  (setq val (* 2 val))
  (command "divide" pause val)
  (setq ss (ssget "p"))
  (setq co 1)
  (setq len (sslength ss))
  (repeat len
    (setq en (ssname ss co))
    (setq det (entget en))
    (entdel en)
    (setq co (+ co 2))
  )
)


You are not telling it to divide with a block

 

replace

 

(command "divide" pause val)

 

with

 

(command "divide" pause "_B" "xxx" ("_Y" or "_N") val)

replace "xxx" with the name of the block you want to divide the line with
delete "_Y" or "_N" depending on whether you want to align the blocks "_Y" or not "_N"

 

I'm not sure what the rest of you code is trying to do

 

I am not one of the robots you're looking for

Message 4 of 10
shefipmoosa
in reply to: 3wood

autocad divide option are different,This code iam using for placing no.of lights.( if 3 lights lighting placement methord is starting point point to x, next two point are 2x ,and 3rd to end x ) this code already customized as per this requirement. but I gave number of point its coming to point style, I need to add selected block / block name instead of point style.

Message 5 of 10
Kent1Cooper
in reply to: shefipmoosa


@shefipmoosa wrote:

.... if 3 lights lighting placement methord is starting point point to x, next two point are 2x ,and 3rd to end x .....


You can use the DIV+ command in DivideMeasurePlus.lsp, available >here<.  One of its many enhancements over ordinary DIVIDE is that it has an option to place the markers [with Blocks as one of the options] at the midpoints  of the divided segments, rather than at the dividing points.  You would use the Block option and use that midpoints option with 3 as the number of divisions.

Kent Cooper, AIA
Message 6 of 10
Sea-Haven
in reply to: shefipmoosa

Sounds like a custom divide take length divide by a spacing, then start 1st block at a distance from start end is same distance. Plenty of code examples provide the required spacing.

screenshot243.png

Message 7 of 10
Kent1Cooper
in reply to: Sea-Haven


@Sea-Haven wrote:

... take length divide by a spacing, then start 1st block at a distance from start end is same distance. ....

screenshot243.png


If I understood the OP's description correctly, this is what they're really looking for:

DivX-2X.PNG

 

DIV+ will do that.  Here's the command sequence that did the above [dark blue are typed-in entries]:

 

Command: DIV+

Divide with Points/Blocks/Lines/Selection ? <P>: S
For Selection set with which to Divide,
Select objects: {select the Circle, which can be anywhere} 1 found

Select objects: {Enter to complete selection}
Base point in relation to Selection: CEN of {pick on the Circle to get its center}
Selection rotation, or Aligned with path or Relative angle to path [angle/A/R] <A>: {enter to accept default -- doesn't matter in this case}

Enter number of Segments, or M for Maximum spacing <M>: 3

Place Selection at division points (Standard) or at Midpoints of divisions [S/M]? <S>: M

Select object to Divide: {select the Line}

Select object to Divide: {enter to end command}

 

Kent Cooper, AIA
Message 8 of 10
Kent1Cooper
in reply to: Kent1Cooper

... and note that in line with the original request, DIV+ offers a Blocks option, also, and if that is chosen, the rotation [which doesn't matter for a Circle] has several options [more than regular Divide offers].

Kent Cooper, AIA
Message 9 of 10
Sea-Haven
in reply to: Kent1Cooper

Your right just need the poster now to respond its nice to know if it matched their needs.

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

GREAT SIR, THANKS

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report