Adding a prefix to a dimension override

Adding a prefix to a dimension override

Anonymous
Not applicable
1,406 Views
13 Replies
Message 1 of 14

Adding a prefix to a dimension override

Anonymous
Not applicable

Is there anyone that can edit this lisp routine so that it adds the prefix to an overridden dimension?

 

(defun c:rowround ()

(vl-load-com)

(setq letterlength 1)
(setq nextletter "A")
(setq letters "ABCDEFGHIJKLMNOPQRSTUVWXYZAABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZAAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ")

(setq prefixposition 0)

(while (/= nextletter nil)

(if (> prefixposition 25)
(and
(setq letterlength 2)
;(setq prefixposition (+ prefixposition 1))
))

(setq nextletter (substr letters (+ prefixposition 1) letterlength))
(setq textString (getstring (strcat "\nEnter starting letter or <Enter> for next letter " nextletter " : ")))



(if (or (= textstring nil)(= textstring "")) (setq textstring nextletter)(setq textstring (strcase textstring)))



(setq prefixposition (vl-string-search textstring letters))
(setq dimobject (entsel))
(setq dimdxf (entget (car dimobject)))

(setq dimobjectename (car dimobject))

(setq vladimobject (vlax-ename->vla-object dimobjectename))



(setq splits (vla-get-textprefix vladimobject))

(if (> (vl-string-search "SPLITS" splits) 0)
(setq tprefix (strcat "ROW '" textstring "' (SPLITS) - "))
(setq tprefix (strcat "ROW '" textstring "' - "))
)
(setq splits "")

(if (= (cdr (assoc 0 dimdxf)) "DIMENSION")
(vla-put-textprefix vladimobject tprefix)
(princ "NO"))

(setq prefixposition (+ prefixposition 1))


)

 

 


)

0 Likes
Accepted solutions (2)
1,407 Views
13 Replies
Replies (13)
Message 2 of 14

dlanorh
Advisor
Advisor

Attached is example lisp. It's not exactly what you require as the sequence is A->Z, AA->AZ, BA->BZ....ZA->ZZ, AAA->AAZ etc, but that can be altered as I've just bolted two lisps together and briefly tested.

 

 

 

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

0 Likes
Message 3 of 14

dlanorh
Advisor
Advisor
Accepted solution

Had a chance to play with this lisp this morning. This now increments A->Z, AA,BB->ZZ and AAA->ZZZ. Lisp (rowround2.lsp) is attached. I have also updated the previous lisp (rowround.lsp) also attached. Command for both is the same. The choice is yours.

 

You can enter the start letter in upper or lower case and it will automatically be uppercase. It will continue to ask you to select a dimension object until a null selection is made (select a blank area of screen) or it reaches ZZZ.

 

 

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

0 Likes
Message 4 of 14

Anonymous
Not applicable

Thanks this works exactly how I need it to!

0 Likes
Message 5 of 14

Anonymous
Not applicable

This works great, but it doesn't add the prefix to an overridden dimension. I use a lisp routine that adds a foot to the actual dimension. I need the prefix added to the rounded dimension instead of the actual dimension. 

0 Likes
Message 6 of 14

dlanorh
Advisor
Advisor

Which one are you using rowround or rowround2? Is the dimension always overridden?

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

0 Likes
Message 7 of 14

Anonymous
Not applicable

I used rowround2. There will be instances when it will be overridden and when it will be an actual dimension.

0 Likes
Message 8 of 14

dlanorh
Advisor
Advisor

Updated attached. This should work, and handle both cases, but I can't test at the moment as I'm on an LT version. Please advise if there is a problem.

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

0 Likes
Message 9 of 14

dlanorh
Advisor
Advisor
Accepted solution

Disregard the above, I managed to get the new (if) the wrong way round. The attached is correct and tested.

 

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

0 Likes
Message 10 of 14

Anonymous
Not applicable

Thanks for all your help.

Message 11 of 14

dlanorh
Advisor
Advisor

Glad I could help 👍

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

0 Likes
Message 12 of 14

Anonymous
Not applicable

Is it possible to have numbers function the same way? For example, if I type 1 the prefix stays as 1 after the first selection. The only way to go in order would be to hit escape after each selection and enter the number needed.

0 Likes
Message 13 of 14

dlanorh
Advisor
Advisor

Do you want a separate lisp to do this or included as a separate option to the current lisp?

 

Do you want any number below 10 or 100 padding with 0's (zeros) i.e. 001 002 ..010 011 etc?

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

0 Likes
Message 14 of 14

Anonymous
Not applicable

Ok sorry for the confusion. I would need to be able to type any word in for the prefix. 

0 Likes