agentiskb Posted 21 hours ago Share Posted 21 hours ago My company numbers drawings where (ideally) Layout Page 1 shows the number "1" and all subsequent pages show 1.1, 1.2, 1.3. I think this may not be possible.The last option I tried was this: Anyone good at this that sees the error????? TIA # Finds a page-like index by probing the owner chain (works with classes like NVPublisher) def detect_page_index(obj) o = obj 0.upto(6) do break unless o # Try common method names first [:page_number, :page, :sheet_number, :sheet, :index].each do |m| if o.respond_to?(m) begin v = o.send(m) vi = v.is_a?(Integer) ? v : (v.respond_to?(:to_i) ? v.to_i : nil) return vi if vi && vi >= 0 && vi < 1000 rescue end end end # Fallback: scan any method that looks page-ish pageish = o.methods.grep(/page|sheet|index|number/i).reject { |m| m.to_s.end_with?('=') } pageish.each do |m| begin v = o.send(m) vi = v.is_a?(Integer) ? v : (v.respond_to?(:to_i) ? v.to_i : nil) return vi if vi && vi >= 0 && vi < 1000 rescue end end o = o.respond_to?(:owner) ? o.owner : nil end 0 end pn = (defined?(owner) && owner) ? detect_page_index(owner) : 0 # Your mapping: # 0 -> "0" # 1 -> "1" # 2 -> "1.1" # 3 -> "1.2" ... if pn <= 0 "0" elsif pn == 1 "1" # no trailing .0 on page 1 else val = 1.0 + 0.1 * (pn - 1) format('%.1f', val) end Link to comment Share on other sites More sharing options...
JKEdmo Posted 20 hours ago Share Posted 20 hours ago May be simpler solution... Does this work for you? Add "#" after manual text "A-1.". The "#" will tell Chief to auto update the sheet number. 1 Link to comment Share on other sites More sharing options...
agentiskb Posted 4 hours ago Author Share Posted 4 hours ago I'll give it a try, thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now