Good morning Structo,
I'm not sure I understand, you want the first line to be "0" without selecting origin?
Just so you know, "Ordinate" dimensions sees "0" at the origin of the current coordinate system being used.
So that is why I have the routine ask for "origin" (because it isn't at that point already).
If it were me, while doing your work, I would put the line you want at "0" at "0,0" while in the World Coordinate System, and then you wouldn't need to select the origin.
The lisp routine would need to get adjusted, see below, I removed the "place origin" part:
Code:
(defun c:foo2 (/ lin la lr1) ;; defines function "foo2" (command) you can change to whatever you'd like, and (/ list of local variables)
(setvar "ucsicon" 3) ;; sets your uscicon to on and at origin
(setq lin (ssget)) ;; sets "lin" equal to what you select (you select all the lines you want dimensioned)
(setq la (getvar "clayer")) ;; records your current layer and sets it equal to "la"
(setq lr1 (tblsearch "layer" "Dim")) ;; searches for the layer named "Dim" and sets it equal to "lr1"
(if (= lr1 nil) ;; if "lr1" not found (doesn't exist) it moves to the following function, if found, skips following function
(command "-layer" "make" "Dim" "color" "6" "" "")) ;;makes the layer "Dim" because it wasn't found
(command "-layer" "t" "Dim" "s" "Dim" "") ;; thaws and sets "Dim" layer current
(command "_qdim" lin "" "ordinate" pause "") ;; runs the quick-dim command, ordinate dimensions, on the lines and origin you selected, (you need to place the dims)
(setvar "clayer" la) ;; re-sets your recorded current layer
(princ)
) ;; end of routine
(princ)
Also attached a version of your "sample" drawing, you'll see the bottom of the first line is at "0,0" in the WCS, which is were it should be to do what you want to do.