Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in mcxplotshapes #227

Closed
ChenJY-L opened this issue Jul 12, 2024 · 1 comment
Closed

Bug in mcxplotshapes #227

ChenJY-L opened this issue Jul 12, 2024 · 1 comment

Comments

@ChenJY-L
Copy link

ChenJY-L commented Jul 12, 2024

Dear Prof. Fang Qianqian:
MCX is an amazing repo.
There is a bug in mcxpreview.m dealing with "Grid", "Box" and "subgrid".
The originate of box doesn't change acroing to my settings.
cfg.shapes=['{ "Shapes":['... '{"ZLayers":[[1,2,2]]}, {"Box": {"Tag":3, "O":[50,50,50], "Size":[50,50,10]}}' ... '] }'];
Because of the code in

case {'Grid', 'Box', 'Subgrid'}
if (strcmp(sname{1}, 'Grid') && ~isempty(hseg))
delete(hseg);
hseg = [];
end
obj = shp.(sname{1});
if (isfield(obj, 'Tag'))
tag = obj.Tag;
end
gridsize = obj.Size;
[no, fc] = latticegrid([0 obj.Size(1)], [0 obj.Size(2)], [0 obj.Size(3)]);
hseg(end + 1) = plotmesh(no * voxelsize, fc, 'facealpha', 0.3, 'linestyle', '-', 'facecolor', 'none', varargin{:});

I tried to fix it using these code.
Thanks for this amazing work again.
Best wishes.
Jiayu Chen

case {'Grid','Box','Subgrid'}
      if(strcmp(sname{1},'Grid') && ~isempty(hseg))
          delete(hseg);
          hseg=[];
      end
      obj=shp.(sname{1});
      if(isfield(obj,'Tag'))
          tag=obj.Tag;
      end
          
      gridsize=obj.Size;
      if(isfield(obj, 'O'))
          [no,fc]=latticegrid([obj.O(1) obj.Size(1)+obj.O(1)],[obj.O(2) obj.Size(2)+obj.O(2)],[obj.O(3) obj.Size(3)+obj.O(3)]);
      else
          [no,fc]=latticegrid([0 obj.Size(1)],[0 obj.Size(2)],[0 obj.Size(3)]);
      end
      hseg(end+1)=plotmesh(no*voxelsize,fc,'facealpha',0.3, 'linestyle', '-', 'facecolor','none', varargin{:});
@fangq fangq closed this as completed in b17cb1a Jul 14, 2024
@fangq
Copy link
Owner

fangq commented Jul 14, 2024

thanks for reporting this and the patch. it should be fixed now in b17cb1a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants