Batch mode solidworks: http://ossandcad.blogspot.com/2008/04/batch-mode-solidworks.html
Example use case:
MaterialPropertyValues Property (IModelDoc2)
C++/CLI
property Object^ MaterialPropertyValues {
Object^ get();
void set (Object^ value);
}
Background on setters http://www.codeguru.com/cpp/cpp/cpp_managed/general/article.php/c14815/CCLI-Primer.htm http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1600.html http://www.codeproject.com/Articles/10352/C-CLI-Properties-Syntactic-sugar-for-accessor-meth http://msdn.microsoft.com/en-us/library/vstudio/2f1ec0b1.aspx
Troubleshooting method info: http://compgroups.net/comp.lang.ruby/win32ole-passing-an-array-to-autocad/747477 http://www.ruby-doc.org/stdlib-2.0/libdoc/win32ole/rdoc/WIN32OLE_METHOD.html
Wrapping the object in the correct type: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/win32ole/rdoc/WIN32OLE_VARIANT.html http://www.ruby-doc.org/stdlib-2.0/libdoc/win32ole/rdoc/WIN32OLE/VARIANT.html http://www.pocketsoap.com/4s4c/docs/datatypes.html
Getter works
vals = model.MaterialPropertyValues
Naive setter does not behave as expected
model.MaterialPropertyValues = vals # sets to some erroneous values
See method info
h = model.ole_method_help('MaterialPropertyValues=')
puts h.name
puts " dispid:"
puts " #{h.dispid}"
puts " args:"
h.params.each do |p|
puts " #{p.ole_type} #{p.name}"
end
Use an array of doubles
arr = WIN32OLE_VARIANT.array([vals.count], WIN32OLE::VARIANT::VT_R8)
(0..vals.count-1).to_a.each do |i|
arr[i] = vals[i]
end
model.MaterialPropertyValues = arr