Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

divide with block

shefipmoosa
Contributor

divide with block

shefipmoosa
Contributor
Contributor

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))
  )
)
0 Likes
Reply
Accepted solutions (1)
1,755 Views
9 Replies
Replies (9)

3wood
Advisor
Advisor

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

Capture.PNG

0 Likes

dlanorh
Advisor
Advisor

@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

0 Likes

shefipmoosa
Contributor
Contributor

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.

0 Likes

Kent1Cooper
Consultant
Consultant

@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
0 Likes

Sea-Haven
Mentor
Mentor

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

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

@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
0 Likes

Kent1Cooper
Consultant
Consultant

... 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
0 Likes

Sea-Haven
Mentor
Mentor

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

0 Likes

shefipmoosa
Contributor
Contributor

GREAT SIR, THANKS

0 Likes